This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] add skeleton for option processing


This patch adds skeleton code for processing options in lto1.  This
cleans up (but does not remove) the -Wall warning which started
occurring in the x86_64 tests after the last merge.  Instead of

    "-Wall" is valid for Ada/C/C++/Fortran/Java/ObjC/ObjC++ but not for

they now print

    "-Wall" is valid for Ada/C/C++/Fortran/Java/ObjC/ObjC++ but not for LTO

We can discuss whether it makes more sense to support -Wall with LTO
or modify abi-x86_64.exp to stop passing -Wall during linking.

In either case, several of us are working on changes now which will
require new command-line options, so I figured it's a good idea to
have this in place.

Ollie

2008-05-09  Ollie Wild  <aaw@google.com>

        * lang.opt: New file.
        * lto-lang.c (lto_init_options): New function.
        (lto_handle_option): New function.
        (lto_init): Move initialization of flag_unit_at_a_time to
        lto_init_options.
        (LANG_HOOKS_INIT_OPTIONS): Define.
        (LANG_HOOKS_HANDLE_OPTION): Define.
commit 97ff4c3cca84becf4ebd3ad7a01c7395f733c1f3
Author: Ollie Wild <aaw@google.com>
Date:   Tue May 6 17:21:56 2008 -0700

    Adds LTO option processing skeleton.
    
    This enables proper diagnostics for unsupported options.
    
    	gcc/lto/
    	* lang.opt: New file.
    	* lto-lang.c (lto_init_options): New function.
    	(lto_handle_option): New function.
    	(lto_init): Move initialization of flag_unit_at_a_time to
    	lto_init_options.
    	(LANG_HOOKS_INIT_OPTIONS): Define.
    	(LANG_HOOKS_HANDLE_OPTION): Define.

diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt
new file mode 100644
index 0000000..9c876e2
--- /dev/null
+++ b/gcc/lto/lang.opt
@@ -0,0 +1,25 @@
+; Options for the LTO front end.
+; Copyright (C) 2008 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+; 
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+; 
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+; See the GCC internals manual for a description of this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+Language
+LTO
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 151e980..093e5f1 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -288,6 +288,40 @@ static GTY(()) tree registered_builtin_fndecls;
 
 /* Language hooks.  */
 
+static unsigned int
+lto_init_options (unsigned int argc ATTRIBUTE_UNUSED,
+		  const char **argv ATTRIBUTE_UNUSED)
+{
+  /* Always operate in unit-at-time mode so that we can defer
+     decisions about what to output.  */
+  flag_unit_at_a_time = 1;
+
+  return CL_LTO;
+}
+
+/* Handle command-line option SCODE.  If the option takes an argument, it is
+   stored in ARG, which is otherwise NULL.  VALUE holds either a numerical
+   argument or a binary value indicating whether the positive or negative form
+   of the option was supplied.  */
+
+static int
+lto_handle_option (size_t scode, const char *arg, int value)
+{
+  enum opt_code code = (enum opt_code) scode;
+  int result;
+
+  switch (code)
+    {
+    /* For now, this is a placeholder.  We'll populate it later.  */
+
+    default:
+      result = 0;
+      break;
+    }
+
+  return result;
+}
+
 static bool 
 lto_mark_addressable (tree t ATTRIBUTE_UNUSED)
 {
@@ -528,10 +562,6 @@ lto_build_c_type_nodes (void)
 static bool
 lto_init (void)
 {
-  /* Always operate in unit-at-time mode so that we can defer
-     decisions about what to output.  */
-  flag_unit_at_a_time = 1;
-
   /* Create the basic integer types.  */
   build_common_tree_nodes (flag_signed_char, 
 			   /*signed_sizetype=*/false);
@@ -585,6 +615,10 @@ static void lto_init_ts (void)
    being.  */
 #undef LANG_HOOKS_NAME
 #define LANG_HOOKS_NAME "GNU C"
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS lto_init_options
+#undef LANG_HOOKS_HANDLE_OPTION
+#define LANG_HOOKS_HANDLE_OPTION lto_handle_option
 #define LANG_HOOKS_MARK_ADDRESSABLE lto_mark_addressable
 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]