Skip to content

Commit 2e69ee9

Browse files
committed
Fix Misra C++ warnings
lib/vfvalue.cpp:118:25: style: A switch statement shall be a well-formed switch statement. [premium-misra-cpp-2008-6-4-3] std::string result = "symbolic=" + tokvalue->expressionString(); ^ lib/valueflow.cpp:141:75: style: In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##. [premium-misra-cpp-2008-16-0-6] define bailout2(type, tokenlist, errorLogger, tok, what) bailoutInternal(type, tokenlist, errorLogger, tok, what, __FILE__, __LINE__, __func__) ^ lib/valueflow.cpp:143:81: style: In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##. [premium-misra-cpp-2008-16-0-6] define bailout(tokenlist, errorLogger, tok, what) bailout2("valueFlowBailout", tokenlist, errorLogger, tok, what) ^ lib/valueflow.cpp:145:114: style: In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##. [premium-misra-cpp-2008-16-0-6] define bailoutIncompleteVar(tokenlist, errorLogger, tok, what) bailoutInternal("valueFlowBailoutIncompleteVar", tokenlist, errorLogger, tok, what, "", 0, __func__) ^ lib/valueflow.cpp:9416:270: style: In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##. [premium-misra-cpp-2008-16-0-6] define VALUEFLOW_ADAPTOR(cpp, ...) \ ^
1 parent ebc90d3 commit 2e69ee9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/valueflow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ static void bailoutInternal(const std::string& type, const TokenList &tokenlist,
138138
errorLogger->reportErr(errmsg);
139139
}
140140

141-
#define bailout2(type, tokenlist, errorLogger, tok, what) bailoutInternal(type, tokenlist, errorLogger, tok, what, __FILE__, __LINE__, __func__)
141+
#define bailout2(type, tokenlist, errorLogger, tok, what) bailoutInternal((type), (tokenlist), (errorLogger), (tok), (what), __FILE__, __LINE__, __func__)
142142

143-
#define bailout(tokenlist, errorLogger, tok, what) bailout2("valueFlowBailout", tokenlist, errorLogger, tok, what)
143+
#define bailout(tokenlist, errorLogger, tok, what) bailout2("valueFlowBailout", (tokenlist), (errorLogger), (tok), (what))
144144

145-
#define bailoutIncompleteVar(tokenlist, errorLogger, tok, what) bailoutInternal("valueFlowBailoutIncompleteVar", tokenlist, errorLogger, tok, what, "", 0, __func__)
145+
#define bailoutIncompleteVar(tokenlist, errorLogger, tok, what) bailoutInternal("valueFlowBailoutIncompleteVar", (tokenlist), (errorLogger), (tok), (what), "", 0, __func__)
146146

147147
static std::string debugString(const ValueFlow::Value& v)
148148
{
@@ -9415,7 +9415,7 @@ static ValueFlowPassAdaptor<F> makeValueFlowPassAdaptor(const char* name, bool c
94159415

94169416
#define VALUEFLOW_ADAPTOR(cpp, ...) \
94179417
makeValueFlowPassAdaptor(#__VA_ARGS__, \
9418-
cpp, \
9418+
(cpp), \
94199419
[](TokenList& tokenlist, \
94209420
SymbolDatabase& symboldatabase, \
94219421
ErrorLogger* errorLogger, \

lib/vfvalue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ namespace ValueFlow {
115115
case ValueType::LIFETIME:
116116
return "lifetime=" + tokvalue->str();
117117
case ValueType::SYMBOLIC:
118+
{
118119
std::string result = "symbolic=" + tokvalue->expressionString();
119120
if (intvalue > 0)
120121
result += "+" + std::to_string(intvalue);
121122
else if (intvalue < 0)
122123
result += "-" + std::to_string(-intvalue);
123124
return result;
124125
}
126+
}
125127
throw InternalError(nullptr, "Invalid ValueFlow Value type");
126128
}
127129

0 commit comments

Comments
 (0)