diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index c6fa3e934..836bc3ac0 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -67,7 +67,8 @@ static const char *usage1 = (const char*)"\ -ignoremissing - Ignore missing include files\n\ -importall - Follow all #include statements as imports\n\ -includeall - Follow all #include statements\n\ - -erroraswarn - Treat (or not) the CPP #error statement as #warning instead\n\ + -cpperraswarn - Treat the CPP #error statement as #warning instead\n\ + -nocpperraswarn - Don't treat the CPP #error statement as #warning, i.e., crash as CPP\n\ -l - Include SWIG library file \n\ -M - List all dependencies \n\ -MD - Is equivalent to `-M -MF ', except `-E' is not implied\n\ @@ -518,18 +519,12 @@ void SWIG_getoptions(int argc, char *argv[]) } else if (strcmp(argv[i],"-ignoremissing") == 0) { Preprocessor_ignore_missing(1); Swig_mark_arg(i); - } else if (strcmp(argv[i],"-erroraswarn") == 0) { - String *erroraswarn = 0; + } else if (strcmp(argv[i],"-cpperraswarn") == 0) { + Preprocessor_error_as_warning(1); + Swig_mark_arg(i); + } else if (strcmp(argv[i],"-nocpperraswarn") == 0) { + Preprocessor_error_as_warning(0); Swig_mark_arg(i); - if (argv[i+1]) { - erroraswarn = NewString(argv[i+1]); - Swig_mark_arg(i+1); - } - if (!erroraswarn) { - Swig_arg_error(); - } else { - Preprocessor_error_as_warning(atoi(Char(erroraswarn))); - } } else if (strcmp(argv[i],"-tm_debug") == 0) { tm_debug = 1; Swig_mark_arg(i); diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 9c674ad39..dc4755429 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1521,12 +1521,12 @@ Preprocessor_parse(String *s) } } else if (StringEqual(id,k_warning)) { if (allow) { - Swig_warning(WARN_PP_CPP_WARNING,Getfile(s),Getline(id),"%s\n", value); + Swig_warning(WARN_PP_CPP_WARNING,Getfile(s),Getline(id),"CPP #warning: %s\n", value); } } else if (StringEqual(id,k_error)) { if (allow) { if (error_as_warning) { - Swig_warning(WARN_PP_CPP_ERROR,Getfile(s),Getline(id),"%s\n", value); + Swig_warning(WARN_PP_CPP_ERROR,Getfile(s),Getline(id),"CPP #error: %s\n", value); } else { Swig_error(Getfile(s),Getline(id),"%s\n",value); } @@ -1580,8 +1580,8 @@ Preprocessor_parse(String *s) if (strncmp(c,"nowarn=",7) == 0) { Swig_warnfilter(c+7,1); } - else if (strncmp(c,"erroraswarn=",7) == 0) { - error_as_warning = atoi(c+12); + else if (strncmp(c,"cpperraswarn=",7) == 0) { + error_as_warning = atoi(c+13); } } }