aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2010-04-12 23:58:18 +0000
committerMatthias Klose <doko@gcc.gnu.org>2010-04-12 23:58:18 +0000
commit4adbd5dd3cf5801e622fcfff3149a27940d34089 (patch)
tree03b93cac03234238b2a22c3947bc8bcd44f3d7fb /gcc/gcc.c
parente0db9cc648242cbbea38cc3c559663acb501aee8 (diff)
downloadgcc-4adbd5dd3cf5801e622fcfff3149a27940d34089.zip
gcc-4adbd5dd3cf5801e622fcfff3149a27940d34089.tar.gz
gcc-4adbd5dd3cf5801e622fcfff3149a27940d34089.tar.bz2
gcc.c (cc1_options): Handle -iplugindir before processing the cc1 spec.
gcc/ 2010-04-13 Matthias Klose <doko@ubuntu.com> * gcc.c (cc1_options): Handle -iplugindir before processing the cc1 spec. Only add -iplugindir once. (cpp_unique_options): Add -iplugindir option if -fplugin* options found. * common.opt (iplugindir): Remove `Separate' property, initialize. * plugin.c (default_plugin_dir_name): Error with missing -iplugindir option. * Makefile.in (check-%, check-parallel-%): Create plugin dir. (distclean): Remove plugin dir. 2010-04-13 Basile Starynkevitch <basile@starynkevitch.net> * doc/plugins.texi (Loading Plugins): Document short -fplugin=foo option. (Plugin API): Mention default_plugin_dir_name function. * gcc.c (find_file_spec_function): Add new declaration. (static_spec_func): Use it for "find-file". (find_file_spec_function): Add new function. (cc1_options): Add -iplugindir option if -fplugin* options found. * gcc-plugin.h (default_plugin_dir_name): Added new declaration. * plugin.c (add_new_plugin): Updated comment, and handle short plugin name. (default_plugin_dir_name): Added new function. * common.opt (iplugindir): New option to set the plugin directory. gcc/testsuite/ 2010-04-13 Matthias Klose <doko@ubuntu.com> * gcc.dg/plugindir1.c: New testcase. * gcc.dg/plugindir2.c: New testcase. * gcc.dg/plugindir3.c: New testcase. * gcc.dg/plugindir4.c: New testcase. From-SVN: r158247
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index cee4bf7..d219053 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -403,6 +403,7 @@ static const char *if_exists_else_spec_function (int, const char **);
static const char *replace_outfile_spec_function (int, const char **);
static const char *version_compare_spec_function (int, const char **);
static const char *include_spec_function (int, const char **);
+static const char *find_file_spec_function (int, const char **);
static const char *print_asm_header_spec_function (int, const char **);
static const char *compare_debug_dump_opt_spec_function (int, const char **);
static const char *compare_debug_self_opt_spec_function (int, const char **);
@@ -872,6 +873,7 @@ static const char *cpp_unique_options =
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
%{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\
+ %{!iplugindir*:%{fplugin*:-iplugindir=%:find-file(plugin)}}\
%{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{fmudflap:-D_MUDFLAP -include mf-runtime.h}\
%{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h}\
@@ -894,6 +896,7 @@ static const char *cpp_debug_options = "%{d*}";
/* NB: This is shared amongst all front-ends, except for Ada. */
static const char *cc1_options =
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
+ %{!iplugindir*:%{fplugin*:-iplugindir=%:find-file(plugin)}}\
%1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\
%{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \
%{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} \
@@ -1726,6 +1729,7 @@ static const struct spec_function static_spec_functions[] =
{ "replace-outfile", replace_outfile_spec_function },
{ "version-compare", version_compare_spec_function },
{ "include", include_spec_function },
+ { "find-file", find_file_spec_function },
{ "print-asm-header", print_asm_header_spec_function },
{ "compare-debug-dump-opt", compare_debug_dump_opt_spec_function },
{ "compare-debug-self-opt", compare_debug_self_opt_spec_function },
@@ -8710,6 +8714,22 @@ include_spec_function (int argc, const char **argv)
return NULL;
}
+/* %:find-file spec function. This function replace its argument by
+ the file found thru find_file, that is the -print-file-name gcc
+ program option. */
+static const char *
+find_file_spec_function (int argc, const char**argv)
+{
+ const char *file;
+
+ if (argc != 1)
+ abort ();
+
+ file = find_file (argv[0]);
+ return file;
+}
+
+
/* %:print-asm-header spec function. Print a banner to say that the
following output is from the assembler. */