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]

[RFA]: Clean up C front ends init_options langhook


This arose out of the next step I want to do with the options stuff.
The patch removes c_language, and uses flag_cxx instead, which is
canonical with use of flag_objc.  It converts all C front ends
to use the same langhook for init_options.  I also see little point
in having two diagnostics different only in the text "C" or "C++"
so I reworded them in the same way we avoid the issue in cpplib.

Gaby - as you can see in this patch, C++ has initializing calls to
diagnostic_line_cutoff() and diagnostic_prefixing_rule() -- is there
a good reason why C and ObjC don't do this too?

OK to commit?

Neil.

	* c-common.c (enum c_language_kind, flag_objc): Remove.
	(fix_string_type, check_case_value, c_common_nodes_and_builtins,
	c_add_case_label, finish_label_addr_expr, boolean_increment):
	Use flag_cxx.
	* c-common.h (enum c_language_kind, c_language): Remove.
	(flag_objc): Make bool.
	(flag_cxx): New.
	(c_common_init_options): Update prototype.
	* c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use flag_cxx.
	* c-format.c (C_STD_VER, C_STD_NAME): Use flag_cxx.
	* c-lang.c (c_init_options): Remove.
	(flag_objc, flag_cxx): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* c-lex.c (lex_charconst): Use flag_cxx.
	* c-opts.c (lang_flags): Make function-local.
	(c_common_init_options): Use flag_cxx, not c_language.  Handle
	C++ diagnostic requirements.
	(c_common_handle_option, c_common_post_options): Use flag_cxx.
	* c-pch.c (get_ident): Use flag_cxx.
	* c-pretty-print.c (pp_c_bool_literal): Use flag_cxx.
	* objc/objc-lang.c (flag_objc, flag_cxx): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	(objc_init_options): Remove.
cp:
	* Make-lang.in: Update.
	* cp-lang.c (flag_objc, flag_cxx): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* cp-tree.h (cxx_init_options): Remove.
	* lex.c: Don't include diagnostic.h.
	(cxx_init_options): Remove.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.423
diff -u -p -r1.423 c-common.c
--- c-common.c	25 Jun 2003 22:14:26 -0000	1.423
+++ c-common.c	28 Jun 2003 22:01:20 -0000
@@ -87,10 +87,6 @@ cpp_reader *parse_in;		/* Declared in c-
 			: "long long unsigned int"))
 #endif
 
-/* The variant of the C language being processed.  */
-
-enum c_language_kind c_language;
-
 /* The following symbols are subsumed in the c_global_trees array, and
    listed here individually for documentation purposes.
 
@@ -228,9 +224,6 @@ const char *pch_file;
    user's namespace.  */
 int flag_iso;
 
-/* Nonzero whenever Objective-C functionality is being used.  */
-int flag_objc;
-
 /* Nonzero if -undef was given.  It suppresses target built-in macros
    and assertions.  */
 int flag_undef;
@@ -1166,7 +1159,7 @@ fix_string_type (tree value)
   /* Compute the number of elements, for the array type.  */
   nchars = wide_flag ? length / wchar_bytes : length;
 
-  if (pedantic && nchars - 1 > nchars_max && c_language == clk_c)
+  if (pedantic && nchars - 1 > nchars_max && !flag_cxx)
     pedwarn ("string length `%d' is greater than the length `%d' ISO C%d compilers are required to support",
 	     nchars - 1, nchars_max, flag_isoc99 ? 99 : 89);
 
@@ -1868,7 +1861,7 @@ check_case_value (tree value)
        switch (...) { case i: ... }
 
      So, we try to reduce the VALUE to a constant that way.  */
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     {
       value = decl_constant_value (value);
       STRIP_TYPE_NOPS (value);
@@ -3155,25 +3148,25 @@ c_common_nodes_and_builtins (void)
   /* `signed' is the same as `int'.  FIXME: the declarations of "signed",
      "unsigned long", "long long unsigned" and "unsigned short" were in C++
      but not C.  Are the conditionals here needed?  */
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     record_builtin_type (RID_SIGNED, NULL, integer_type_node);
   record_builtin_type (RID_LONG, "long int", long_integer_type_node);
   record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
   record_builtin_type (RID_MAX, "long unsigned int",
 		       long_unsigned_type_node);
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
   record_builtin_type (RID_MAX, "long long int",
 		       long_long_integer_type_node);
   record_builtin_type (RID_MAX, "long long unsigned int",
 		       long_long_unsigned_type_node);
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     record_builtin_type (RID_MAX, "long long unsigned",
 			 long_long_unsigned_type_node);
   record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
   record_builtin_type (RID_MAX, "short unsigned int",
 		       short_unsigned_type_node);
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     record_builtin_type (RID_MAX, "unsigned short",
 			 short_unsigned_type_node);
 
@@ -3334,7 +3327,7 @@ c_common_nodes_and_builtins (void)
   wchar_type_node = get_identifier (MODIFIED_WCHAR_TYPE);
   wchar_type_node = TREE_TYPE (identifier_global_value (wchar_type_node));
   wchar_type_size = TYPE_PRECISION (wchar_type_node);
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     {
       if (TREE_UNSIGNED (wchar_type_node))
 	wchar_type_node = make_unsigned_type (wchar_type_size);
@@ -3954,12 +3947,7 @@ c_add_case_label (splay_tree cases, tree
 
   /* Case ranges are a GNU extension.  */
   if (high_value && pedantic)
-    {
-      if (c_language == clk_cplusplus)
-	pedwarn ("ISO C++ forbids range expressions in switch statements");
-      else
-	pedwarn ("ISO C forbids range expressions in switch statements");
-    }
+    pedwarn ("range expressions in switch statements are non-standard");
 
   type = TREE_TYPE (cond);
   if (low_value)
@@ -4076,12 +4064,7 @@ finish_label_address_expr (tree label)
   tree result;
 
   if (pedantic)
-    {
-      if (c_language == clk_cplusplus)
-	pedwarn ("ISO C++ forbids taking the address of a label");
-      else
-	pedwarn ("ISO C forbids taking the address of a label");
-    }
+    pedwarn ("taking the address of a label is non-standard");
 
   if (label == error_mark_node)
     return error_mark_node;
@@ -4550,9 +4533,7 @@ tree
 boolean_increment (enum tree_code code, tree arg)
 {
   tree val;
-  tree true_res = (c_language == clk_cplusplus
-		   ? boolean_true_node
-		   : c_bool_true_node);
+  tree true_res = (flag_cxx ? boolean_true_node : c_bool_true_node);
   arg = stabilize_reference (arg);
   switch (code)
     {
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.184
diff -u -p -r1.184 c-common.h
--- c-common.h	23 Jun 2003 15:27:34 -0000	1.184
+++ c-common.h	28 Jun 2003 22:01:20 -0000
@@ -231,13 +231,6 @@ extern GTY(()) tree c_global_trees[CTI_M
    warning if they undergo concatenation.  */
 #define C_ARTIFICIAL_STRING_P(NODE) TREE_LANG_FLAG_0 (NODE)
 
-typedef enum c_language_kind
-{
-  clk_c = 0,      /* A dialect of C: K&R C, ANSI/ISO C89, C2000, etc.  */
-  clk_cplusplus   /* ANSI/ISO C++ */
-}
-c_language_kind;
-
 /* Information about a statement tree.  */
 
 struct stmt_tree_s GTY(()) {
@@ -351,11 +344,6 @@ struct c_lang_decl GTY(()) {
 #define DECL_NUM_STMTS(NODE) \
   (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
 
-/* The variant of the C language being processed.  Each C language
-   front-end defines this variable.  */
-
-extern c_language_kind c_language;
-
 /* Nonzero if we can read a PCH file now.  */
 
 extern int allow_pch;
@@ -394,8 +382,11 @@ extern const char *pch_file;
 
 extern int flag_iso;
 
-/* Nonzero whenever Objective-C functionality is being used.  */
-extern int flag_objc;
+/* True whenever Objective-C functionality is being used.  */
+extern bool flag_objc;
+
+/* True whenever the C++ front end is being used.  */
+extern bool flag_cxx;
 
 /* Nonzero if -undef was given.  It suppresses target built-in macros
    and assertions.  */
@@ -952,7 +943,7 @@ extern void disable_builtin_function (co
 
 extern tree build_va_arg (tree, tree);
 
-extern int c_common_init_options (enum c_language_kind);
+extern int c_common_init_options (void);
 extern bool c_common_post_options (const char **);
 extern bool c_common_init (void);
 extern void c_common_finish (void);
Index: c-cppbuiltin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-cppbuiltin.c,v
retrieving revision 1.12
diff -u -p -r1.12 c-cppbuiltin.c
--- c-cppbuiltin.c	19 Jun 2003 19:43:58 -0000	1.12
+++ c-cppbuiltin.c	28 Jun 2003 22:01:21 -0000
@@ -255,7 +255,7 @@ define__GNUC__ (void)
   while (ISDIGIT (*v))
     v++;
   builtin_define_with_value_n ("__GNUC__", q, v - q);
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     builtin_define_with_value_n ("__GNUG__", q, v - q);
 
   if (*v != '.' || !ISDIGIT (v[1]))
@@ -294,7 +294,7 @@ c_cpp_builtins (cpp_reader *pfile)
   /* For stddef.h.  They require macros defined in c-common.c.  */
   c_stddef_cpp_builtins ();
 
-  if (c_language == clk_cplusplus)
+  if (flag_cxx)
     {
       if (SUPPORTS_ONE_ONLY)
 	cpp_define (pfile, "__GXX_WEAK__=1");
@@ -303,6 +303,7 @@ c_cpp_builtins (cpp_reader *pfile)
       if (warn_deprecated)
 	cpp_define (pfile, "__DEPRECATED");
     }
+
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
   if (flag_exceptions)
@@ -375,7 +376,7 @@ c_cpp_builtins (cpp_reader *pfile)
   if (!flag_signed_char)
     cpp_define (pfile, "__CHAR_UNSIGNED__");
 
-  if (c_language == clk_cplusplus && TREE_UNSIGNED (wchar_type_node))
+  if (flag_cxx && TREE_UNSIGNED (wchar_type_node))
     cpp_define (pfile, "__WCHAR_UNSIGNED__");
 
   /* Make the choice of ObjC runtime visible to source code.  */
Index: c-format.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-format.c,v
retrieving revision 1.43
diff -u -p -r1.43 c-format.c
--- c-format.c	28 Jun 2003 16:23:17 -0000	1.43
+++ c-format.c	28 Jun 2003 22:01:21 -0000
@@ -259,7 +259,7 @@ enum format_std_version
    or inheriting from, for the purpose of format features supported.  */
 #define CPLUSPLUS_STD_VER	STD_C94
 /* The C standard version we are checking formats against when pedantic.  */
-#define C_STD_VER		((int)(c_language == clk_cplusplus	  \
+#define C_STD_VER		((int)(flag_cxx				  \
 				 ? CPLUSPLUS_STD_VER			  \
 				 : (flag_isoc99				  \
 				    ? STD_C99				  \
@@ -267,7 +267,7 @@ enum format_std_version
 /* The name to give to the standard version we are warning about when
    pedantic.  FEATURE_VER is the version in which the feature warned out
    appeared, which is higher than C_STD_VER.  */
-#define C_STD_NAME(FEATURE_VER) (c_language == clk_cplusplus	\
+#define C_STD_NAME(FEATURE_VER) (flag_cxx			\
 				 ? "ISO C++"			\
 				 : ((FEATURE_VER) == STD_EXT	\
 				    ? "ISO C"			\
Index: c-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lang.c,v
retrieving revision 1.105
diff -u -p -r1.105 c-lang.c
--- c-lang.c	25 Jun 2003 17:29:12 -0000	1.105
+++ c-lang.c	28 Jun 2003 22:01:21 -0000
@@ -31,7 +31,8 @@ Software Foundation, 59 Temple Place - S
 #include "langhooks.h"
 #include "langhooks-def.h"
 
-static int c_init_options (void);
+bool flag_objc = false;
+bool flag_cxx = false;
 
 /* ### When changing hooks, consider if ObjC needs changing too!! ### */
 
@@ -42,7 +43,7 @@ static int c_init_options (void);
 #undef LANG_HOOKS_FINISH
 #define LANG_HOOKS_FINISH c_common_finish
 #undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS c_init_options
+#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
 #undef LANG_HOOKS_HANDLE_OPTION
 #define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
 #undef LANG_HOOKS_POST_OPTIONS
@@ -158,12 +159,6 @@ const char *const tree_code_name[] = {
 #include "c-common.def"
 };
 #undef DEFTREECODE
-
-static int
-c_init_options (void)
-{
-  return c_common_init_options (clk_c);
-}
 
 /* Used by c-lex.c, but only for objc.  */
 
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.205
diff -u -p -r1.205 c-lex.c
--- c-lex.c	22 Jun 2003 13:41:24 -0000	1.205
+++ c-lex.c	28 Jun 2003 22:01:22 -0000
@@ -665,7 +665,7 @@ lex_charconst (const cpp_token *token)
     type = wchar_type_node;
   /* In C, a character constant has type 'int'.
      In C++ 'char', but multi-char charconsts have type 'int'.  */
-  else if ((c_language == clk_c) || chars_seen > 1)
+  else if (flag_cxx || chars_seen > 1)
     type = integer_type_node;
   else
     type = char_type_node;
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.64
diff -u -p -r1.64 c-opts.c
--- c-opts.c	26 Jun 2003 06:05:28 -0000	1.64
+++ c-opts.c	28 Jun 2003 22:01:22 -0000
@@ -50,8 +50,6 @@ Software Foundation, 59 Temple Place - S
 # define TARGET_EBCDIC 0
 #endif
 
-static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
-
 static int saved_lineno;
 
 /* CPP's options.  */
@@ -213,25 +211,39 @@ defer_opt (enum opt_code code, const cha
 
 /* Common initialization before parsing options.  */
 int
-c_common_init_options (enum c_language_kind lang)
+c_common_init_options ()
 {
-  c_language = lang;
-  parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89 : CLK_GNUCXX,
+  static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
+ 
+  /* This is conditionalized only because that is the way the front
+     ends used to do it.  Maybe this should be unconditional?  */
+  if (flag_cxx)
+    {
+      /* By default wrap lines at 80 characters.  Is getenv ("COLUMNS")
+	 preferable?  */
+      diagnostic_line_cutoff (global_dc) = 80;
+
+      /* By default, emit location information once for every
+	 diagnostic message.  */
+      diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
+    }
+
+  parse_in = cpp_create_reader (flag_cxx ? CLK_GNUCXX: CLK_GNUC89,
 				ident_hash);
+
   cpp_opts = cpp_get_options (parse_in);
   cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
+  cpp_opts->objc = flag_objc;
 
   /* Reset to avoid warnings on internal definitions.  We set it just
      before passing on command-line options to cpplib.  */
   cpp_opts->warn_dollars = 0;
 
-  if (flag_objc)
-    cpp_opts->objc = 1;
-
-  flag_const_strings = (lang == clk_cplusplus);
-  warn_pointer_arith = (lang == clk_cplusplus);
+  flag_exceptions = flag_cxx;
+  flag_const_strings = flag_cxx;
+  warn_pointer_arith = flag_cxx;
 
-  return lang_flags[(c_language << 1) + flag_objc];
+  return lang_flags[flag_cxx * 2 + flag_objc];
 }
 
 /* Handle switch SCODE with argument ARG.  ON is true, unless no-
@@ -366,7 +378,7 @@ c_common_handle_option (size_t scode, co
       warn_parentheses = value;
       warn_return_type = value;
       warn_sequence_point = value;	/* Was C only.  */
-      if (c_language == clk_cplusplus)
+      if (flag_cxx)
 	warn_sign_compare = value;
       warn_switch = value;
       warn_strict_aliasing = value;
@@ -381,17 +393,17 @@ c_common_handle_option (size_t scode, co
       if (warn_uninitialized != 1)
 	warn_uninitialized = (value ? 2 : 0);
 
-      if (c_language == clk_c)
-	/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
-	   can turn it off only if it's not explicit.  */
-	warn_main = value * 2;
-      else
+      if (flag_cxx)
 	{
 	  /* C++-specific warnings.  */
 	  warn_nonvdtor = value;
 	  warn_reorder = value;
 	  warn_nontemplate_friend = value;
 	}
+      else
+	/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
+	   can turn it off only if it's not explicit.  */
+	warn_main = value * 2;
 
       cpp_opts->warn_trigraphs = value;
       cpp_opts->warn_comments = value;
@@ -644,17 +656,17 @@ c_common_handle_option (size_t scode, co
       break;
 
     case OPT_Wwrite_strings:
-      if (c_language == clk_c)
-	flag_const_strings = value;
-      else
+      if (flag_cxx)
 	warn_write_strings = value;
+      else
+	flag_const_strings = value;
       break;
 
     case OPT_ansi:
-      if (c_language == clk_c)
-	set_std_c89 (false, true);
-      else
+      if (flag_cxx)
 	set_std_cxx98 (true);
+      else
+	set_std_c89 (false, true);
       break;
 
     case OPT_d:
@@ -662,7 +674,7 @@ c_common_handle_option (size_t scode, co
       break;
 
     case OPT_fcond_mismatch:
-      if (c_language == clk_c)
+      if (!flag_cxx)
 	{
 	  flag_cond_mismatch = value;
 	  break;
@@ -1053,8 +1065,7 @@ c_common_post_options (const char **pfil
   sanitize_cpp_opts ();
 
   register_include_chains (parse_in, sysroot, iprefix,
-			   std_inc, std_cxx_inc && c_language == clk_cplusplus,
-			   verbose);
+			   std_inc, std_cxx_inc && flag_cxx, verbose);
 
   flag_inline_trees = 1;
 
Index: c-pch.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pch.c,v
retrieving revision 1.11
diff -u -p -r1.11 c-pch.c
--- c-pch.c	22 Jun 2003 13:41:24 -0000	1.11
+++ c-pch.c	28 Jun 2003 22:01:22 -0000
@@ -62,12 +62,10 @@ get_ident(void)
   static const char template[IDENT_LENGTH] = "gpch.011";
   
   memcpy (result, template, IDENT_LENGTH);
-  if (c_language == clk_c)
-    result[4] = flag_objc ? 'o' : 'C';
-  else if (c_language == clk_cplusplus)
+  if (flag_cxx)
     result[4] = flag_objc ? 'O' : '+';
   else
-    abort ();
+    result[4] = flag_objc ? 'o' : 'C';
   return result;
 }
 
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.16
diff -u -p -r1.16 c-pretty-print.c
--- c-pretty-print.c	22 Jun 2003 13:41:24 -0000	1.16
+++ c-pretty-print.c	28 Jun 2003 22:01:22 -0000
@@ -336,18 +336,18 @@ pp_c_bool_literal (c_pretty_printer ppi,
 {
   if (b == boolean_false_node || integer_zerop (b))
     {
-      if (c_language == clk_cplusplus)
+      if (flag_cxx)
 	pp_c_identifier (ppi, "false");
-      else if (c_language == clk_c && flag_isoc99)
+      else if (flag_isoc99)
 	pp_c_identifier (ppi, "_False");
       else
 	pp_unsupported_tree (ppi, b);
     }
   else if (b == boolean_true_node)
     {
-      if (c_language == clk_cplusplus)
+      if (flag_cxx)
 	pp_c_identifier (ppi, "true");
-      else if (c_language == clk_c && flag_isoc99)
+      else if (flag_isoc99)
 	pp_c_identifier (ppi, "_True");
       else
 	pp_unsupported_tree (ppi, b);
Index: cp/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.154
diff -u -p -r1.154 Make-lang.in
--- cp/Make-lang.in	23 Jun 2003 20:52:12 -0000	1.154
+++ cp/Make-lang.in	28 Jun 2003 22:01:23 -0000
@@ -232,8 +232,7 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h 
 	$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
 
 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \
-  c-pragma.h toplev.h output.h input.h diagnostic.h \
-  cp/operators.def $(TM_P_H)
+  c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H)
 cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
   $(LANGHOOKS_DEF_H) c-common.h
 cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.51
diff -u -p -r1.51 cp-lang.c
--- cp/cp-lang.c	24 Jun 2003 11:54:00 -0000	1.51
+++ cp/cp-lang.c	28 Jun 2003 22:01:23 -0000
@@ -30,6 +30,9 @@ Boston, MA 02111-1307, USA.  */
 #include "langhooks.h"
 #include "langhooks-def.h"
 
+bool flag_objc = false;
+bool flag_cxx = true;
+
 static HOST_WIDE_INT cxx_get_alias_set (tree);
 static bool ok_to_generate_alias_set_for_type (tree);
 static bool cxx_warn_unused_global_decl (tree);
@@ -48,7 +51,7 @@ static bool cp_var_mod_type_p (tree);
 #undef LANG_HOOKS_CLEAR_BINDING_STACK
 #define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
 #undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS cxx_init_options
+#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
 #undef LANG_HOOKS_HANDLE_OPTION
 #define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
 #undef LANG_HOOKS_POST_OPTIONS
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.861
diff -u -p -r1.861 cp-tree.h
--- cp/cp-tree.h	28 Jun 2003 16:23:25 -0000	1.861
+++ cp/cp-tree.h	28 Jun 2003 22:01:25 -0000
@@ -3905,7 +3905,6 @@ extern void yyhook				(int);
 extern int cp_type_qual_from_rid                (tree);
 extern bool cxx_init				(void);
 extern void cxx_finish (void);
-extern int cxx_init_options (void);
 
 /* in method.c */
 extern void init_method	(void);
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.307
diff -u -p -r1.307 lex.c
--- cp/lex.c	24 Jun 2003 15:40:03 -0000	1.307
+++ cp/lex.c	28 Jun 2003 22:01:25 -0000
@@ -38,7 +38,6 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "tm_p.h"
 #include "timevar.h"
-#include "diagnostic.h"
 
 static int interface_strcmp (const char *);
 static void init_cp_pragma (void);
@@ -147,22 +146,6 @@ int interface_unknown;		/* whether or no
 				   to behave according to #pragma interface.  */
 
 
-/* Initialization before switch parsing.  */
-int
-cxx_init_options (void)
-{
-  /* Default exceptions on.  */
-  flag_exceptions = 1;
-  /* By default wrap lines at 80 characters.  Is getenv ("COLUMNS")
-     preferable?  */
-  diagnostic_line_cutoff (global_dc) = 80;
-  /* By default, emit location information once for every
-     diagnostic message.  */
-  diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
-
-  return c_common_init_options (clk_cplusplus);
-}
-
 void
 cxx_finish (void)
 {
Index: objc/objc-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.31
diff -u -p -r1.31 objc-lang.c
--- objc/objc-lang.c	25 Jun 2003 17:29:14 -0000	1.31
+++ objc/objc-lang.c	28 Jun 2003 22:01:25 -0000
@@ -31,7 +31,8 @@ Boston, MA 02111-1307, USA.  */
 #include "langhooks.h"
 #include "langhooks-def.h"
 
-static int objc_init_options                   PARAMS ((void));
+bool flag_objc = true;
+bool flag_cxx = false;
 
 #undef LANG_HOOKS_NAME
 #define LANG_HOOKS_NAME "GNU Objective-C"
@@ -40,7 +41,7 @@ static int objc_init_options            
 #undef LANG_HOOKS_FINISH
 #define LANG_HOOKS_FINISH c_common_finish
 #undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS objc_init_options
+#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
 #undef LANG_HOOKS_HANDLE_OPTION
 #define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
 #undef LANG_HOOKS_POST_OPTIONS
@@ -165,10 +166,3 @@ const char * const tree_code_name[] = {
 #include "objc-tree.def"
 };
 #undef DEFTREECODE
-
-static int 
-objc_init_options ()
-{
-  flag_objc = 1;
-  return c_common_init_options (clk_c);
-}


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