Preprocessing now errors out if extra tokens appear after #else and #end. Add preprocessor errors when preprocessor expressions are missing
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12464 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7ad6066fdf
commit
efd06d0668
7 changed files with 132 additions and 32 deletions
|
|
@ -84,8 +84,7 @@ pp_constant.i:49: Warning 305: Bad constant value (ignored).
|
|||
|
||||
:::::::::::::::::::::::::::::::: pp_defined.i :::::::::::::::::::::::::::::::::::
|
||||
pp_defined.i:6: Error: No arguments given to defined()
|
||||
pp_defined.i:6: Warning 202: Could not evaluate 'defined'
|
||||
pp_defined.i:6: Warning 202: Error: 'Expected an expression'
|
||||
pp_defined.i:6: Error: Missing expression for #if.
|
||||
|
||||
:::::::::::::::::::::::::::::::: pp_deprecated.i :::::::::::::::::::::::::::::::::::
|
||||
pp_deprecated.i:4: Warning 101: %extern is deprecated. Use %import instead.
|
||||
|
|
@ -119,6 +118,20 @@ pp_macro_expansion_multiline.i:30: Warning 509: as it is shadowed by bar(int *).
|
|||
pp_macro_inline_unterminated.i:9: Error: Unterminated call invoking macro 'foo'
|
||||
pp_macro_inline_unterminated.i:12: Error: Syntax error in input(3).
|
||||
|
||||
:::::::::::::::::::::::::::::::: pp_macro_missing_expression.i :::::::::::::::::::::::::::::::::::
|
||||
pp_macro_missing_expression.i:4: Error: Missing identifier for #ifdef.
|
||||
pp_macro_missing_expression.i:7: Error: Missing identifier for #ifndef.
|
||||
pp_macro_missing_expression.i:10: Error: Missing expression for #if.
|
||||
pp_macro_missing_expression.i:14: Error: Missing expression for #elif.
|
||||
pp_macro_missing_expression.i:21: Error: Missing expression for #elif.
|
||||
|
||||
:::::::::::::::::::::::::::::::: pp_macro_unexpected_tokens.i :::::::::::::::::::::::::::::::::::
|
||||
pp_macro_unexpected_tokens.i:5: Error: Unexpected tokens after #endif.
|
||||
pp_macro_unexpected_tokens.i:8: Error: Unexpected tokens after #endif.
|
||||
pp_macro_unexpected_tokens.i:11: Error: Unexpected tokens after #else.
|
||||
pp_macro_unexpected_tokens.i:18: Error: Unexpected tokens after #endif.
|
||||
pp_macro_unexpected_tokens.i:21: Error: Unexpected tokens after #else.
|
||||
|
||||
:::::::::::::::::::::::::::::::: pp_macro_nargs.i :::::::::::::::::::::::::::::::::::
|
||||
pp_macro_nargs.i:7: Error: Macro 'foo' expects 2 arguments
|
||||
pp_macro_nargs.i:8: Error: Macro 'foo' expects 2 arguments
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ pp_macro_defined_unterminated
|
|||
pp_macro_expansion
|
||||
pp_macro_expansion_multiline
|
||||
pp_macro_inline_unterminated
|
||||
pp_macro_missing_expression
|
||||
pp_macro_unexpected_tokens
|
||||
pp_macro_nargs
|
||||
pp_macro_redef
|
||||
pp_macro_rparen
|
||||
|
|
|
|||
22
Examples/test-suite/errors/pp_macro_missing_expression.i
Normal file
22
Examples/test-suite/errors/pp_macro_missing_expression.i
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Test "Missing identifier for ..." errrors
|
||||
%module xxx
|
||||
|
||||
#ifdef
|
||||
#endif
|
||||
|
||||
#ifndef
|
||||
#endif
|
||||
|
||||
#if
|
||||
#endif
|
||||
|
||||
#if defined(AAA)
|
||||
#elif
|
||||
#endif
|
||||
|
||||
|
||||
#define BBB
|
||||
|
||||
#if !defined(BBB)
|
||||
#elif
|
||||
#endif
|
||||
23
Examples/test-suite/errors/pp_macro_unexpected_tokens.i
Normal file
23
Examples/test-suite/errors/pp_macro_unexpected_tokens.i
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Test "Unexpected tokens after ..." errors
|
||||
%module xxx
|
||||
|
||||
#ifndef AAA
|
||||
#endif rubbish
|
||||
|
||||
#ifdef AAA
|
||||
#endif rubbish
|
||||
|
||||
#ifdef AAA
|
||||
#else rubbish
|
||||
#endif
|
||||
|
||||
#define BBB
|
||||
|
||||
#ifdef BBB
|
||||
#else
|
||||
#endif rubbish
|
||||
|
||||
#if !defined(BBB)
|
||||
#else rubbish
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue