Implement -idirafter.
authorChristoph Mallon <christoph.mallon@gmx.de>
Mon, 9 Jul 2012 07:52:49 +0000 (09:52 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Mon, 9 Jul 2012 15:20:48 +0000 (17:20 +0200)
main.c
preprocessor.c
preprocessor.h

diff --git a/main.c b/main.c
index f0617aa..3f3caff 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1560,6 +1560,12 @@ int main(int argc, char **argv)
                                GET_ARG_AFTER(opt, "-include");
                                add_flag(&cppflags_obst, "-include");
                                add_flag(&cppflags_obst, "%s", opt);
+                       } else if (streq(option, "idirafter")) {
+                               const char *opt;
+                               GET_ARG_AFTER(opt, "-idirafter");
+                               add_flag(&cppflags_obst, "-idirafter");
+                               add_flag(&cppflags_obst, "%s", opt);
+                               append_include_path(&after_searchpath, opt);
                        } else if (streq(option, "isystem")) {
                                const char *opt;
                                GET_ARG_AFTER(opt, "-isystem");
index 3692999..4f3078c 100644 (file)
@@ -120,6 +120,7 @@ struct searchpath_t {
 searchpath_t bracket_searchpath = { NULL, &bracket_searchpath.first, false };
 searchpath_t quote_searchpath   = { NULL, &quote_searchpath.first,   false };
 searchpath_t system_searchpath  = { NULL, &system_searchpath.first,  true  };
+searchpath_t after_searchpath   = { NULL, &after_searchpath.first,   true  };
 
 static whitespace_info_t next_info; /* valid if had_whitespace is true */
 static whitespace_info_t info;
@@ -2571,6 +2572,7 @@ static void setup_include_path(void)
                         c_mode & _CXX ? "CPLUS_INCLUDE_PATH" : "C_INCLUDE_PATH");
 
        /* append system search path to bracket searchpath */
+       append_searchpath(&system_searchpath,  &after_searchpath);
        append_searchpath(&bracket_searchpath, &system_searchpath);
        append_searchpath(&quote_searchpath, &bracket_searchpath);
 }
index 48785a0..5757672 100644 (file)
@@ -30,6 +30,7 @@ extern searchpath_t bracket_searchpath; /**< paths for < > includes */
 extern searchpath_t quote_searchpath;   /**< paths for " " includes */
 extern searchpath_t system_searchpath;  /**< system searchpath (appended to
                                              quote searchpath) */
+extern searchpath_t after_searchpath;   /**< searchpath for -idirafter (also system paths) */
 
 void init_include_paths(void);
 void append_include_path(searchpath_t *searchpath, const char *path);