diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 3e332e5ec6..ac1e5e176d 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -186,6 +186,7 @@ get() { //////////////////////////////////////////////////////////////////// CPPPreprocessor:: CPPPreprocessor() { + _noangles = false; _state = S_eof; _paren_nesting = 0; _angle_bracket_found = false; @@ -1375,7 +1376,12 @@ handle_include_directive(const string &args, int first_line, } } else if (expr[0] == '<' && expr[expr.size() - 1] == '>') { filename = expr.substr(1, expr.size() - 2); - angle_quotes = true; + if (!_noangles) { + // If _noangles is true, we don't make a distinction between + // angle brackets and quote marks--all #include statements are + // treated the same, as if they used quote marks. + angle_quotes = true; + } okflag = true; if (_files.size() == 1) { @@ -1396,7 +1402,6 @@ handle_include_directive(const string &args, int first_line, CPPFile::Source source = CPPFile::S_none; if (okflag) { - found_file = false; // Search the current directory. diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index 4a00a8391d..b73953fdf3 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -72,8 +72,9 @@ public: Manifests _manifests; pvector _quote_include_kind; - DSearchPath _quote_include_path; - DSearchPath _angle_include_path; + DSearchPath _quote_include_path; + DSearchPath _angle_include_path; + bool _noangles; CPPComments _comments; diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index 705d89c208..3ca0abdac8 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -75,6 +75,7 @@ enum CommandOptions { CO_longlong, CO_promiscuous, CO_spam, + CO_noangles, CO_help, }; @@ -101,6 +102,7 @@ static struct option long_options[] = { { "longlong", required_argument, NULL, CO_longlong }, { "promiscuous", no_argument, NULL, CO_promiscuous }, { "spam", no_argument, NULL, CO_spam }, + { "noangles", no_argument, NULL, CO_noangles }, { "help", no_argument, NULL, CO_help }, { NULL } }; @@ -275,7 +277,11 @@ void show_help() { << " -spam\n" << " Generate wrapper functions that report each invocation to Notify.\n" - << " This can sometimes be useful for tracking down bugs.\n\n"; + << " This can sometimes be useful for tracking down bugs.\n\n" + + << " -noangles\n" + << " Treat #include the same as #include \"file\". This means -I\n" + << " and -S are equivalent.\n\n"; } // handle commandline -D options @@ -429,6 +435,10 @@ main(int argc, char *argv[]) { generate_spam = true; break; + case CO_noangles: + parser._noangles = true; + break; + case 'h': case CO_help: show_help();