diff mbox

[google/integration] Add -Xclang-only option (issue6047048)

Message ID 20120418023802.84E2FA0EA2@xoom.chi.corp.google.com
State New
Headers show

Commit Message

Ollie Wild April 18, 2012, 2:38 a.m. UTC
To be submitted to the google/integration branch and merged into
google/{main,gcc-4_6,gcc-4_7}.

Add -Xclang-only option (which is ignored).

This is used by certain drivers to pass options selectively to clang.  Adding
support to the gcc driver makes it easier to test GCC in the absence of these
drivers.

Google ref 6302116.

2012-04-17   Ollie Wild  <aaw@google.com>

	* gcc/common.opt (Xclang-only): New option.
	* gcc/doc/invoke.texi (Xclang-only): Document new option.
	* gcc/gcc.c (display_help): Print new option.
	(driver_handle_option): Support new option (ignoring args).



--
This patch is available for review at http://codereview.appspot.com/6047048

Comments

Diego Novillo April 18, 2012, 12:53 p.m. UTC | #1
On Tue, Apr 17, 2012 at 23:38, Ollie Wild <aaw@google.com> wrote:

> 2012-04-17   Ollie Wild  <aaw@google.com>
>
>        * gcc/common.opt (Xclang-only): New option.
>        * gcc/doc/invoke.texi (Xclang-only): Document new option.
>        * gcc/gcc.c (display_help): Print new option.
>        (driver_handle_option): Support new option (ignoring args).

OK.


Diego.
diff mbox

Patch

diff --git a/gcc/common.opt b/gcc/common.opt
index 4a751a9..39f0843 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -743,6 +743,9 @@  Warn when a vector operation is compiled outside the SIMD
 Xassembler
 Driver Separate
 
+Xclang-only
+Driver Joined
+
 Xlinker
 Driver Separate
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index d980e9f..1b61e76 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9560,6 +9560,11 @@  systems using the GNU linker.  On some targets, such as bare-board
 targets without an operating system, the @option{-T} option may be required
 when linking to avoid references to undefined symbols.
 
+@item -Xclang-only @var{option}
+@opindex Xclang-only
+Ignore @var{option}.  This is used by some custom drivers to pass options
+to Clang but not GCC.
+
 @item -Xlinker @var{option}
 @opindex Xlinker
 Pass @var{option} as an option to the linker.  You can use this to
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 5f789fd..c6b48a6 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2983,6 +2983,7 @@  display_help (void)
   fputs (_("  -Xassembler <arg>        Pass <arg> on to the assembler\n"), stdout);
   fputs (_("  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor\n"), stdout);
   fputs (_("  -Xlinker <arg>           Pass <arg> on to the linker\n"), stdout);
+  fputs (_("  -Xclang-only=<arg>       Ignore <arg>\n"), stdout);
   fputs (_("  -save-temps              Do not delete intermediate files\n"), stdout);
   fputs (_("  -save-temps=<arg>        Do not delete intermediate files\n"), stdout);
   fputs (_("\
@@ -3353,6 +3354,11 @@  driver_handle_option (struct gcc_options *opts,
       do_save = false;
       break;
 
+    case OPT_Xclang_only:
+      /* Ignore the argument.  Used by some drivers to selectively pass
+         arguments to clang.  */
+      break;
+
     case OPT_Xlinker:
       add_infile (arg, "*");
       do_save = false;