aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-06-30 19:36:25 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-06-30 19:36:25 +0000
commit37fa72e9d359a0c00c3b62e9aabd74276daa6602 (patch)
tree01d40120cc52c2574f790a44609bf19f0551b019 /gcc/c-common.h
parent4497827651d07fa10006fbac4cf63a92cf83c2a2 (diff)
downloadgcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.zip
gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.gz
gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.bz2
c-common.c (enum c_language_kind, flag_objc): Remove.
* 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 c_dialect_ macros. * c-common.h (enum c_language_kind): Extend. (c_dialect_cxx, c_dialect_objc): New. (flag_objc): Remove. (c_common_init_options): Update prototype. * c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_ macros. * c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_ macros. * c-format.c (C_STD_VER, C_STD_NAME): Similarly. * c-lang.c (c_init_options): Remove. (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. * c-lex.c (lex_charconst): Use c_dialect_cxx(). * c-opts.c (lang_flags): Make function-local. (c_common_init_options): Use c_dialect_ macros. Handle C++ diagnostic requirements. (c_common_handle_option, c_common_post_options): Use flag_cxx. * c-parse.in (init_reswords): Use c_dialect_objc (). * c-pch.c (get_ident): Use c_language. * c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros. * c-typeck.c (comptypes, build_c_cast): Similarly. * objc/objc-lang.c (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. (objc_init_options): Remove. cp: * Make-lang.in: Update. * cp-lang.c (c_language): 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. From-SVN: r68734
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index d97f460..0843e11 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -233,11 +233,20 @@ extern GTY(()) tree c_global_trees[CTI_MAX];
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++ */
+ clk_c = 0, /* C90, C94 or C99 */
+ clk_objc = 1, /* clk_c with ObjC features. */
+ clk_cxx = 2, /* ANSI/ISO C++ */
+ clk_objcxx = 3 /* clk_cxx with ObjC features. */
}
c_language_kind;
+/* To test for a specific language use c_language, defined by each
+ front end. For "ObjC features" or "not C++" use the macros. */
+extern c_language_kind c_language;
+
+#define c_dialect_cxx() (c_language & clk_cxx)
+#define c_dialect_objc() (c_language & clk_objc)
+
/* Information about a statement tree. */
struct stmt_tree_s GTY(()) {
@@ -351,11 +360,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,9 +398,6 @@ extern const char *pch_file;
extern int flag_iso;
-/* Nonzero whenever Objective-C functionality is being used. */
-extern int flag_objc;
-
/* Nonzero if -undef was given. It suppresses target built-in macros
and assertions. */
@@ -952,7 +953,7 @@ extern void disable_builtin_function (const char *);
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);