From 98cca230ac6d06bb14f8564b93e1324614af25cd Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Tue, 11 Apr 2023 21:58:52 +0200 Subject: restore the unit test --- Examples/test-suite/preproc_predefined.h | 11 +++++++++++ Examples/test-suite/preproc_predefined.i | 2 ++ 2 files changed, 13 insertions(+) (limited to 'Examples') diff --git a/Examples/test-suite/preproc_predefined.h b/Examples/test-suite/preproc_predefined.h index 8d6b6ee28..2eb4cb6f1 100644 --- a/Examples/test-suite/preproc_predefined.h +++ b/Examples/test-suite/preproc_predefined.h @@ -25,3 +25,14 @@ # error Did not detect exactly one target-language-specific macro defined in the generated wrapper. # endif #endif + +/* + * This should not compile in when this bug is present + * https://github.com/swig/swig/issues/2525 + */ + +#define my_bad_attr __attribute__ +#define my_good_attr(x) __attribute__(x) + +int bad my_bad_attr((used)); +int good my_good_attr((used)); diff --git a/Examples/test-suite/preproc_predefined.i b/Examples/test-suite/preproc_predefined.i index 252ef9a1a..4dc2e6eb8 100644 --- a/Examples/test-suite/preproc_predefined.i +++ b/Examples/test-suite/preproc_predefined.i @@ -55,6 +55,8 @@ #endif %} +#define __attribute__(x) + /* Test that SWIGxxx is defined at SWIG-time and in the wrapper. */ %include "preproc_predefined.h" %{ -- cgit v1.2.1