mirror of https://github.com/swig/swig
Add new -U command line option
This undefines a preprocessor symbol. See #2591
This commit is contained in:
parent
b8e756de4c
commit
fba4a82865
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.2.0 (in progress)
|
||||
===========================
|
||||
|
||||
2023-05-18: olly
|
||||
#2591 Add new -U command line option to undefine a preprocessor
|
||||
symbol.
|
||||
|
||||
2023-05-18: olly
|
||||
#1589 #2335 Support parsing arbitrary expression in decltype.
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ General Options
|
|||
-small - Compile in virtual elimination and compact mode
|
||||
-swiglib - Report location of SWIG library and exit
|
||||
-templatereduce - Reduce all the typedefs in templates
|
||||
-U<symbol> - Undefine symbol <symbol>
|
||||
-v - Run in verbose mode
|
||||
-version - Display SWIG version number
|
||||
-Wall - Remove all warning suppression, also implies -Wextra
|
||||
|
|
|
@ -5,3 +5,19 @@
|
|||
#if FOO-0 != 1
|
||||
# error "-DFOO didn't set FOO to 1"
|
||||
#endif
|
||||
|
||||
// Test handling of -D with a value specified
|
||||
|
||||
#if BAR-0 != 123
|
||||
# error "-DBAR=123 didn't set BAR to 123"
|
||||
#endif
|
||||
|
||||
// Test handling of -U
|
||||
|
||||
#ifdef BAZ
|
||||
# error "-UBAZ didn't undefine BAZ"
|
||||
#endif
|
||||
|
||||
#ifdef NOTSET
|
||||
# error "-UNOTSET resulted in NOTSET getting set!"
|
||||
#endif
|
||||
|
|
|
@ -832,7 +832,7 @@ MULTI_CPP_TEST_CASES += \
|
|||
# Custom tests - tests with additional commandline options
|
||||
wallkw.cpptest: SWIGOPT += -Wallkw
|
||||
preproc_include.ctest: SWIGOPT += -includeall
|
||||
command_line_define.ctest: SWIGOPT += -DFOO
|
||||
command_line_define.ctest: SWIGOPT += -DFOO -DBAR=123 -DBAZ -UBAZ -UNOTSET
|
||||
|
||||
# Allow modules to define temporarily failing tests.
|
||||
C_TEST_CASES := $(filter-out $(FAILING_C_TESTS),$(C_TEST_CASES))
|
||||
|
|
|
@ -146,6 +146,7 @@ static const char *usage4 = (const char *) "\
|
|||
-small - Compile in virtual elimination and compact mode\n\
|
||||
-swiglib - Report location of SWIG library and exit\n\
|
||||
-templatereduce - Reduce all the typedefs in templates\n\
|
||||
-U<symbol> - Undefine symbol <symbol>\n\
|
||||
-v - Run in verbose mode\n\
|
||||
-version - Display SWIG version number\n\
|
||||
-Wall - Remove all warning suppression, also implies -Wextra\n\
|
||||
|
@ -487,6 +488,9 @@ static void getoptions(int argc, char *argv[]) {
|
|||
Preprocessor_define(d, 0);
|
||||
Delete(d);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strncmp(argv[i], "-U", 2) == 0) {
|
||||
Preprocessor_undef(argv[i] + 2);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-E") == 0) {
|
||||
cpp_only = 1;
|
||||
Swig_mark_arg(i);
|
||||
|
|
Loading…
Reference in New Issue