[previous] 0887 [next] [U] Use of 'defined' must match either 'defined(identifier)' or 'defined identifier'.
Explicitly undefined REFERENCE - ISO:C90-6.8.1 Conditional Inclusion - Semantics

This 'defined' operator has been misused.

For example:


/*PRQA S 553,2017 ++*/

#if defined(ABC)                   /* OK */
int a = 1;
#endif

#if defined                        /* Message 0887 */
int b = 1;
#endif

#if defined("filename")            /* Message 0887 and also 0888 and 0897 */
int c = 1;
#endif

#if defined 123                    /* Message 0887 and also 0897 */
int d = 1;
#endif


MISRA-C:2004 Rules applicable to message 0887:

Rule  1.2  (Required) No reliance shall be placed on undefined or unspecified behaviour.
Rule  19.14  (Required) The defined preprocessor operator shall only be used in one of the two standard forms.


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents