misc.c (gnat_init_options): Do not concatenate -I and its argument, except for the...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 14 Feb 2011 19:16:34 +0000 (19:16 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 14 Feb 2011 19:16:34 +0000 (19:16 +0000)
* gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and
its argument, except for the special -I- switch.

From-SVN: r170150

gcc/ada/ChangeLog
gcc/ada/gcc-interface/misc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/include.adb [new file with mode: 0644]

index cf72091f9b4c8b6d64752ebc0b13467fdf8ffec6..defad830e15b8fbe5f573eb3f9d4575132c4618d 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and
+       its argument, except for the special -I- switch.
+
 2011-02-12  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * gnat_ugn.texi (Compiling Different Versions of Ada): Update
index 360ebab8aed346af6332369d237c530677af0777..4f7a5e1da1dca5982a9e38f99c2eeba4d095cd97 100644 (file)
@@ -195,13 +195,12 @@ gnat_init_options (unsigned int decoded_options_count,
          || num_elements == 0)
        continue;
 
-      if (decoded_options[i].opt_index == OPT_I)
-       {
-         gcc_assert (num_elements == 2);
-         save_argv[save_argc++]
-           = concat (decoded_options[i].canonical_option[0],
-                     decoded_options[i].canonical_option[1], NULL);
-       }
+      /* Deal with -I- specially since it must be a single switch.  */
+      if (decoded_options[i].opt_index == OPT_I
+         && num_elements == 2
+         && decoded_options[i].canonical_option[1][0] == '-'
+         && decoded_options[i].canonical_option[1][1] == '\0')
+       save_argv[save_argc++] = "-I-";
       else
        {
          gcc_assert (num_elements >= 1 && num_elements <= 2);
index 82e8ba34c01870e44101a0450e760dbe5d3e6614..9d200a419afd51cc5343d47fcf7aa4ed706aeedc 100644 (file)
@@ -1,3 +1,7 @@
+2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/include.adb: New test.
+
 2011-02-14  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/47728
diff --git a/gcc/testsuite/gnat.dg/include.adb b/gcc/testsuite/gnat.dg/include.adb
new file mode 100644 (file)
index 0000000..ec183c7
--- /dev/null
@@ -0,0 +1,4 @@
+-- { dg-do compile } */
+-- { dg-options "-cargs -I -gnatws" }
+
+-- { dg-error "search directory missing" "" { target *-*-* } 0 }