mirror of https://github.com/swig/swig
Add test coverage for #error and #warning
This replaces and extends the coverage lost by the removal of errors testcase pp_deprecated. See #2635
This commit is contained in:
parent
736c052d7d
commit
365a540fdb
|
@ -0,0 +1,9 @@
|
|||
%module xxx
|
||||
|
||||
#warning Print this warning
|
||||
|
||||
#error This is an error
|
||||
|
||||
#error Another error
|
||||
|
||||
#warning Another warning
|
|
@ -0,0 +1,4 @@
|
|||
pp_error_directive.i:3: Warning 204: CPP #warning, "Print this warning".
|
||||
pp_error_directive.i:5: Error: CPP #error "This is an error". Use the -cpperraswarn option to continue swig processing.
|
||||
pp_error_directive.i:7: Error: CPP #error "Another error". Use the -cpperraswarn option to continue swig processing.
|
||||
pp_error_directive.i:9: Warning 204: CPP #warning, "Another warning".
|
|
@ -124,6 +124,33 @@ void another_macro_checking(void) {
|
|||
# wobble wobble
|
||||
#endif
|
||||
|
||||
/* Check that #error is ignored inside an inactive conditional. */
|
||||
#ifdef THIS_IS_NOT_DEFINED
|
||||
# error should not trigger 1
|
||||
#endif
|
||||
#ifdef AAA
|
||||
# define B
|
||||
#else
|
||||
# error should not trigger 2
|
||||
#endif
|
||||
#if 0
|
||||
# error should not trigger 3
|
||||
#endif
|
||||
|
||||
/* Check that #warning is ignored inside an inactive conditional. */
|
||||
#ifdef THIS_IS_NOT_DEFINED
|
||||
# warning should not trigger 1
|
||||
#endif
|
||||
#ifdef AAA
|
||||
# define B
|
||||
#else
|
||||
# warning should not trigger 2
|
||||
#endif
|
||||
#if 0
|
||||
# warning should not trigger 3
|
||||
#endif
|
||||
|
||||
|
||||
/* Regression test for https://sourceforge.net/p/swig/bugs/1163/
|
||||
* ONE(1)(2) should expand to `2` but SWIG was expanding it to `TWO(2)`
|
||||
* which results in the generated C wrapper failing to compile.
|
||||
|
|
Loading…
Reference in New Issue