summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMomtchil Momtchev <momtchil@momtchev.com>2023-04-11 21:58:52 +0200
committerMomtchil Momtchev <momtchil@momtchev.com>2023-04-11 21:58:52 +0200
commit98cca230ac6d06bb14f8564b93e1324614af25cd (patch)
tree6930e12e1025503df5f708e8739ecd3e18312017
parent80f23effa4dea35279679acc715286e33bf3a850 (diff)
downloadswig-98cca230ac6d06bb14f8564b93e1324614af25cd.tar.gz
restore the unit test
-rw-r--r--Examples/test-suite/preproc_predefined.h11
-rw-r--r--Examples/test-suite/preproc_predefined.i2
2 files changed, 13 insertions, 0 deletions
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"
%{