c-common.h (c_language_kind): New type.
authorMark Mitchell <mark@codesourcery.com>
Tue, 6 Jun 2000 21:54:54 +0000 (21:54 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 6 Jun 2000 21:54:54 +0000 (21:54 +0000)
* c-common.h (c_language_kind): New type.
(c_language): New variab.e
* c-common.c (lang_get_alias_set): Don't put structures in
non-zero alias sets in C++.
* c-decl.c (c_language): Define it.
* c-lex.c (doing_objc_thang): Remove.
* c-tree.h (doing_objc_thang): Make it a macro.
* objc/objc-act.c (lang_decode_option): Set c_language, not
doing_objc_thang.

* decl2.c (c_language): Define.

From-SVN: r34439

gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-decl.c
gcc/c-lex.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/objc/objc-act.c

index d0986da6a6933143e5da7ce29ce3791a4a1e5324..5c76f0d6e28ea28cad3a9f031f360c60a1485268 100644 (file)
@@ -1,3 +1,15 @@
+2000-06-06  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-common.h (c_language_kind): New type.
+       (c_language): New variab.e
+       * c-common.c (lang_get_alias_set): Don't put structures in
+       non-zero alias sets in C++.
+       * c-decl.c (c_language): Define it.
+       * c-lex.c (doing_objc_thang): Remove.
+       * c-tree.h (doing_objc_thang): Make it a macro.
+       * objc/objc-act.c (lang_decode_option): Set c_language, not
+       doing_objc_thang. 
+       
 2000-06-06  Gabriel Dos Reis  <gdr@codesourcery.com>
 
        * diagnostic.c (output_maximum_width): Remove.
index d9c50bd9e4f2b7b0674bfc4a91d5454a2111e7c7..b025215e7e163576d6e75d39969ff064b86edb5c 100644 (file)
@@ -3338,6 +3338,10 @@ lang_get_alias_set (t)
       if (t1 != t)
        return get_alias_set (t1);
     }
+  /* It's not yet safe to use alias sets for classes in C++ because
+     the TYPE_FIELDs list for a class doesn't mention base classes.  */
+  else if (c_language == clk_cplusplus && AGGREGATE_TYPE_P (t));
+    return 0;
 
   return -1;
 }
index d0427241062ca43a72dcef889ba21ee2899d2c53..8953d7037ec1ad2266e0a0db4e754b158a860f49 100644 (file)
@@ -56,6 +56,19 @@ enum c_tree_index
 
 extern tree c_global_trees[CTI_MAX];
 
+typedef enum c_language_kind
+{
+  clk_c,           /* A dialect of C: K&R C, ANSI/ISO C89, C2000,
+                      etc. */
+  clk_cplusplus,   /* ANSI/ISO C++ */
+  clk_objective_c  /* Objective C */
+} 
+c_language_kind;
+
+/* The variant of the C language being processed.  Each C language
+   front-end defines this variable.  */
+extern c_language_kind c_language;
+
 #define wchar_type_node                        c_global_trees[CTI_WCHAR_TYPE]
 #define signed_wchar_type_node         c_global_trees[CTI_SIGNED_WCHAR_TYPE]
 #define unsigned_wchar_type_node       c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
index 3c57f66983eda8397fe9e07de7981d8cf86aa12b..ba1b3c6a009d580f186cfb45f8f5c22698d3a846 100644 (file)
@@ -454,6 +454,10 @@ int warn_float_equal = 0;
 
 int warn_multichar = 1;
 
+/* The variant of the C language being processed.  */
+
+c_language_kind c_language = clk_c;
+
 /* Nonzero means `$' can be in an identifier.  */
 
 #ifndef DOLLARS_IN_IDENTIFIERS
index 3ca8264cba9f708938eda94b4352baa0410d7e1e..beda889d5896991c46458950a98b545a0fefac47 100644 (file)
@@ -132,10 +132,6 @@ int linemode;
    used in a context which makes it a reference to a variable.  */
 tree lastiddecl;
 
-/* Nonzero enables objc features.  */
-
-int doing_objc_thang;
-
 extern int yydebug;
 
 /* File used for outputting assembler code.  */
index 68e6f47a656dc554237bf7e78636806c26f8847d..ae27e61d6d9494685bee1699ff8f6a37ac608c2e 100644 (file)
@@ -446,7 +446,8 @@ extern int system_header_p;
 
 /* Nonzero enables objc features.  */
 
-extern int doing_objc_thang;
+#define doing_objc_thang \
+  (c_language == clk_objective_c)
 
 /* In c-decl.c */
 extern void finish_incomplete_decl PARAMS ((tree));
index 48b861fbab34195c2cccb4ac2dcfad88b577b06d..d549fc6732841ed5d963da79c4d8b31aa90206ed 100644 (file)
@@ -1,3 +1,7 @@
+2000-06-06  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl2.c (c_language): Define.
+
 2000-06-06  Gabriel Dos Reis  <gdr@codesourcery.com>
 
        * lex.c (lang_init_options): Tweak.
index f23512c9718ef74052e75e6390a6e27f63f679aa..6fc7bb5b98efba83d8b708cce3f6b3da64ba0dd5 100644 (file)
@@ -501,6 +501,10 @@ int flag_enforce_eh_specs = 1;
 
 void (*back_end_hook) PARAMS ((tree));
 
+/* The variant of the C language being processed.  */
+
+c_language_kind c_language = clk_cplusplus;
+
 /* Table of language-dependent -f options.
    STRING is the option name.  VARIABLE is the address of the variable.
    ON_VALUE is the value to store in VARIABLE
index 7dc4b115d52615f94247994328cf77f5eda34ddd..e1b9cd3ebaeade5e28fb569c88a3cf0f3538ce95 100644 (file)
@@ -798,7 +798,7 @@ lang_decode_option (argc, argv)
 {
   const char *p = argv[0];
   if (!strcmp (p, "-lang-objc"))
-    doing_objc_thang = 1;
+    c_language = clk_objective_c;
   else if (!strcmp (p, "-gen-decls"))
     flag_gen_declaration = 1;
   else if (!strcmp (p, "-Wselector"))