Don't accept some invalid preprocessor code
Whitespace or non-numeric characters are required after a preprocessor directive that requires an expression.
This commit is contained in:
parent
532999f4f2
commit
72964a1faf
4 changed files with 48 additions and 1 deletions
|
|
@ -24,3 +24,20 @@
|
|||
#if 0
|
||||
#elif 8.8
|
||||
#endif
|
||||
|
||||
/* Missing whitespace after preproc directive */
|
||||
#if123
|
||||
#endif
|
||||
|
||||
#if456e
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#warning This should not warn
|
||||
#elif1
|
||||
#warning This should also not warn
|
||||
#endif
|
||||
|
||||
#if(1)
|
||||
#warning Warning okay: #if(1)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,3 +12,8 @@ pp_expressions_bad.i:21: Warning 202: Could not evaluate expression '2e3'
|
|||
pp_expressions_bad.i:21: Warning 202: Error: 'Floating point constant in preprocessor expression'
|
||||
pp_expressions_bad.i:25: Warning 202: Could not evaluate expression '8.8'
|
||||
pp_expressions_bad.i:25: Warning 202: Error: 'Floating point constant in preprocessor expression'
|
||||
pp_expressions_bad.i:29: Error: Unknown SWIG preprocessor directive: if123 (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_expressions_bad.i:30: Error: Extraneous #endif.
|
||||
pp_expressions_bad.i:32: Error: Unknown SWIG preprocessor directive: if456e (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_expressions_bad.i:33: Error: Extraneous #endif.
|
||||
pp_expressions_bad.i:42: Warning 204: CPP #warning, "Warning okay: #if(1)".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue