-DFOO on the SWIG command line now sets FOO to 1
This is consistent with C/C++ compiler preprocessors. Previously SWIG set FOO to an empty value. Fixes #2193
This commit is contained in:
parent
9d7c962ee8
commit
b06ab566cb
4 changed files with 18 additions and 1 deletions
|
|
@ -477,7 +477,10 @@ static void getoptions(int argc, char *argv[]) {
|
|||
Swig_mark_arg(i);
|
||||
} else if (strncmp(argv[i], "-D", 2) == 0) {
|
||||
String *d = NewString(argv[i] + 2);
|
||||
Replace(d, "=", " ", DOH_REPLACE_FIRST);
|
||||
if (Replace(d, "=", " ", DOH_REPLACE_FIRST) == 0) {
|
||||
// Match C preprocessor behaviour whereby -DFOO sets FOO=1.
|
||||
Append(d, " 1");
|
||||
}
|
||||
Preprocessor_define((DOH *) d, 0);
|
||||
Delete(d);
|
||||
// Create a symbol
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue