From: Mark Mitchell Date: Tue, 6 Jun 2000 21:54:54 +0000 (+0000) Subject: c-common.h (c_language_kind): New type. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b2abab835bee5248adb9d6c65f41517840f595a;p=gcc.git c-common.h (c_language_kind): New type. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0986da6a69..5c76f0d6e28 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2000-06-06 Mark Mitchell + + * 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 * diagnostic.c (output_maximum_width): Remove. diff --git a/gcc/c-common.c b/gcc/c-common.c index d9c50bd9e4f..b025215e7e1 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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; } diff --git a/gcc/c-common.h b/gcc/c-common.h index d0427241062..8953d7037ec 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -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] diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 3c57f66983e..ba1b3c6a009 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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 diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 3ca8264cba9..beda889d589 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -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. */ diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 68e6f47a656..ae27e61d6d9 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -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)); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 48b861fbab3..d549fc67328 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-06-06 Mark Mitchell + + * decl2.c (c_language): Define. + 2000-06-06 Gabriel Dos Reis * lex.c (lang_init_options): Tweak. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index f23512c9718..6fc7bb5b98e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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 diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 7dc4b115d52..e1b9cd3ebae 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -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"))