JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
An expression is not sufficiently parenthesized, so does not meet the explicit operator precendece requirements of Misra2012:12.1, Misra2004:12.1, and MisraC++2008:5-0-2. In particular, either:
For the purposes of this warning class, operator precedences are as specified in Misra2012:12.1:
Description Operator or Operand Precedence Primary identifier, constant, string literal, ( expression ) 16 (high) Postfix [] () (function call) . -> ++ (post-increment) -- (post-decrement) () {} (C99: compound literal) 15 Unary ++ (pre-increment) -- (pre-decrement) & * + - ~ ! sizeof defined (preprocessor) 14 Cast () 13 Multiplicative * / % 12 Additive + - 11 Bitwise shift << >> 10 Relational < > <= >= 9 Equality == != 8 Bitwise AND & 7 Bitwise XOR ^ 6 Bitwise OR | 5 Logical AND && 4 Logical OR || 3 Conditional ?: 2 Assignment = *= /= %= += -= <<= >>= &= ^= |= 1 Comma , 0 (low)
| Class Name | Missing Parentheses | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | style | |||||||||||||||||||||||||||||||||||||||
| Mnemonic | LANG.STRUCT.PARENS | |||||||||||||||||||||||||||||||||||||||
| Categories |
|
|||||||||||||||||||||||||||||||||||||||
| Availability | Available for C and C++. |
|||||||||||||||||||||||||||||||||||||||
| Enabling | Checks for this warning class are disabled by default,
and require the unnormalized
C ASTs for the project. To enable them, add the following
WARNING_FILTER rule and RETAIN_UNNORMALIZED_C_AST specification to the project configuration file.
RETAIN_UNNORMALIZED_C_AST = Yes WARNING_FILTER += allow class="Missing Parentheses" |
#include <stddef.h>
int lang_struct_parens(void){
int x=1;
size_t s,t;
s = sizeof x; /* 'Missing Parentheses' warning issued here */
t = sizeof(x); /* sizeof argument parenthesized */
x = x << t + s; /* 'Missing Parentheses' warning issued here */
x += x << (t + s); /* sub-expression parenthesized */
return x;
}
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.