📄 read80.txt
字号:
with program legibility.
520 Highest operator or function lacks side-effects -- The first
expression of a for clause should either be one of the
privileged operators: assignment, increment, decrement or call
to an impure function or one modifying its argument(s).
521 Highest operator or function lacks side-effects -- The third
expression of a for clause should either be one of the
privileged operators: assignment, increment, decrement or call
to an impure function or one modifying its argument(s).
522 Highest operator or function lacks side-effects -- If a
statement consists only of an expression, it should either be
one of the privileged operators: assignment, increment,
decrement or call to an impure function or one modifying its
argument(s). For example if operator * is the built-in
operator, the statement *p++; draws this message but p++; does
not. This is because the highest operator is '*' which has no
side effects.
584 Trigraph sequence (??Char) detected -- This message is issued
whenever a trigraph sequence is detected and the trigraph
processing has been turned off (with a -ftg). If this is not
within a string (or character) constant then the trigraph
sequence is ignored. This is useful if your compiler does not
process trigraph sequences and you want linting to mirror
compilation. Outside of a string we issue the Warning but we
do translate the sequence since it cannot make syntactic sense
in its raw state.
660 Option 'String' requests removing an extent that is not on the
list -- A number of options use the '-' prefix to remove and
'+' to add elements to a list. For example to add (the most
unusual) extension .C++ to designate C++ processing of files
bearing that extension, a programmer should employ the option:
+cpp(.C++)
However, if a leading '-' is employed (a natural mistake) this
warning will be emitted.
686 Option 'String' is suspicious because of 'Name' -- An option is
considered suspicious for one of a variety of reasons. The
reason is designated by a reason code that is specified by
Name. At this writing, the only reason code is 'unbalanced
quotes'.
814 useless declaration -- A tagless struct was declared without a
declarator. For example:
struct { int n; };
Such a declaration cannot very well be used.
830 Location cited in prior message -- This message is accurately
described in the manual except for one omission. This message
and message 831 below do not follow the ordinary rules for
message suppression. If they did then when the option -w2 was
employed to turn the warning level down to 2 these messages (at
level 3) would also vanish. Instead they continue to function
as expected. To inhibit them you need to explicitly turn them
off using one of:
-e830
-e831
They may be restored via +e830 and +e831; the state of
suppression can be saved and restored via the -save -restore
options. Options such as -e8* and -e{831} will have no effect.
831 Reference cited in prior message -- See 830 above.
960 Violates MISRA Year Required Rule Name, String -- MISRA is the
"Guidelines for the use of the C Language in Vehicle Based
Software". [9,33] The first version of the MISRA Standard was
released in 1998 and the second in 2004. Lint references the
rules from each version of the Standard using integers for 1998
and in decimal form for 2004, as per the Standard numbering
style.
The list of required checks made for both MISRA 1998 and 2004 are:
Octal constant used (Rule 19/7.1).
Should initialize either all enum members or only the first (Rule 32/9.3).
Side effects on right hand side of logical operator (Rule 33/12.4).
Comma operator used outside of 'for' expression (Rule 42/12.10).
Null statement not in line by itself (Rule 54/14.3).
continue statement should not be used (Rule 57/14.5).
Left brace expected for if, else, for, do, and while (Rules 59/14.8 & 14.9).
Floating point variable used as loop counter (Rule 65/13.4).
Function not declared at file scope (Rule 68/8.6).
Function has variable number of arguments (Rule 69/16.1).
Either all parameters or no parameters should have identifiers (Rule 73/16.3).
'#define/#undef' used within a block (Rule 91/19.5).
Multiple use of '#' and/or '##' operators in macro definition (Rule 98/19.12).
Non-standard use of 'defined' preprocessor operator (Rule 100/19.14).
Required checks made exclusively for MISRA 1998 are:
break used outside of a switch (Rule 58).
Header file name contains non-standard non-standard character (Rule 88).
Bitfields inside union (Rule 110).
Required checks made exclusively for MISRA 2004 are:
No definitions of objects or function in header files (Rule 8.5).
Prohibited implicit conversion (Rules 10.1 & 10.2).
Prohibited cast of complex expressions (Rules 10.3 & 10.4).
Recasting required for operators '~' and '<<' (Rule 10.5).
'sizeof' used on expressions with side effect (Rule 12.3)
Bitwise operator applied to signed underlying type (Rule 12.7).
Prohibited operator applied to unsigned underlying type (Rule 12.9).
More than one 'break' terminates loop (Rule 14.6).
No 'else' at end of 'if ... else if' chain (Rule 14.10).
Boolean value in switch expression (Rule 15.4)
Unions shall not be used (Rule 18.4).
Use of '#undef' prohibited (Rule 19.6)
MISRA 1998 checking is achieved using the -misra(1) option.
For MISRA 2004 checks, use -misra(2).
You may disable individual rules to your taste by using the
Rule number in an esym option. For example:
-esym( 960, 75, 8? )
will suppress MISRA rules 75 and any of the those between 80
and 89 inclusive that are issued as the result of a 960. See
[9,33] for information on the MISRA guidelines
961 Violates MISRA Year Advisory Rule Name, String" -- This message
is issued for some violations of the MISRA advisory guidelines.
Certain rules were advisories in the 1998 Standard and became
required for the 2004 Standard and vice versa. Therefore, you
might see some rules repeated here already listed above for
message 960.
The list of advisory checks made for both MISRA 1998 and 2004 are:
Dependence placed on C's operator precedence (Rule 47/12.1)
Only preprocessor statements and comments before '#include' (Rule 87/19.1).
Advisory checks made exclusively for MISRA 1998 are:
Constant requires numerical suffix (Rule 18)
'register' class discouraged (Rule 28)
'sizeof' used on expressions with side effect (Rule 40)
Redundant explicit casting (Rule 44)
Non-case label (Rule 55)
No 'else' at end of 'if ... else if' chain (Rule 60).
Boolean value in switch expression (Rule 63)
Use of '#undef' is discouraged (Rule 92)
Advisory checks made exclusively for MISRA 2004 are:
Header file name contains non-standard non-standard character (Rule 19.2).
No use of '#' or '##' (Rule 19.13).
Messages can be suppressed based on rule number. See also
Message 960.
1076 Anonymous union assumed to be 'static' -- Anonymous unions need
to be declared static. This is because the names contained
within are considered local to the module in which they are
declared.
1079 Could not find '>' or ',' to terminate default template
parameter at Location -- A default template parameter was found
but it could not be parsed.
1083 Ambiguous conversion between 2nd and 3rd operands of
conditional operator -- If the 2nd operand can be converted to
match the type of the 3rd, and the 3rd operand can be converted
to match the type of the 2nd, then the conditional expression
is considered ill-formed.
1085 Invalid definition of 'String' -- An attempt was made to define
a member of a template before the template was defined.
Example:
template<class T, class U> struct A
{
void f();
};
template<class U, class T> void A<T,U>::f(){} // Error 1085
In this case, the template argument list is out of order; T and
U have been interchanged.
1093 A pure specifier was given for function 'Symbol' which was not
declared virtual -- A pure specifier ("= 0") should not be
placed on a function unless the function had been declared
"virtual".
1549 Exception thrown for function 'Symbol' not declared to throw --
An exception was thrown (i.e., a throw was detected) within a
function and not within a try block; moreover the function was
declared to throw but the exception thrown was not on the list.
If you provide an exception specification, include all the
exception types you potentially will throw. [23, Item 14]
1550 exception 'Name' thrown by function 'Symbol' is not on
throw-list of function 'Symbol' -- A function was called (first
Symbol) which was declared as potentially throwing an
exception. The call was not made from within a try block and
the function making the call had an exception specification.
Either add the exception to the list, or place the call inside
a try block and catch the throw. [23, Item 14].
1560 Uncaught exception 'Name' not on throw-list of function
'Symbol' -- A direct or indirect throw of the named exception
occurred within a try block and was either not caught by any
handler or was rethrown by the handler. Moreover, the function
has an exception specification and the uncaught exception is
not on the list. Note that a function that fails to declare a
list of thrown exceptions is assumed to potentially throw any
exception.
1710 An implicit 'typename' was assumed -- This message is issued
when the standard requires the use of 'typename' to
disambiguate the syntax within a template where it may not be
clear that a name is the name of a type or some non-type. (See
C++ Standard [10], Section 14.6, Para 2). Consider:
template< class T > class A
{
T::N x; // Info 1710
};
Many compilers will accept this construct since the only
interpretation consistent with valid syntax is that T::N
represents a type. (But if the 'x' weren't there it would be
taken as an access declaration and more frequently would be a
non-type).
------ Added Bibliography ------
[28] Sutter, Herb,
Exceptional C++,
Addison-Wesley, Reading MA, 2000, ISBN 0-201-61562-2
[29] Sutter, Herb and Andrei Alexandrescu,
C++ Coding Standards (101 Rules, Guidelines, and Best Practices),
Addison-Wesley, 2005, ISBN 0-321-11358-6
[30] Meyers, Scott,
Effective C++ Third Edition,
Addison-Wesley, Reading MA, 2005, ISBN 0-321-33487-6
[31] Lewis, Bil and Daniel J. Berg,
Multithreaded Programming with Pthreads,
Sun Microsystems Press, 1998, ISBN 0-13-680729-1
[32] Vandevoorde, David and Nicolai M. Josuttis,
C++ Templates -- The Complete Guide,
Addison-Wesley, Boston, 2003, ISBN 0201734842
[33] The Motor Industry Software Reliability Association,
MISRA-C:2004 Guidelines for the use of the C language in critical systems,
The Motor Industry Research Association,
Warwickshire, UK, 2004, ISBN, 0952415623
Gimpel Software
July, 2007
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -