aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2002-08-10 02:18:28 +0000
committerZiemowit Laski <zlaski@gcc.gnu.org>2002-08-10 02:18:28 +0000
commit0f7866e7ba109bc68ae2c0d14ec0399765fc144b (patch)
tree9eae3f190177c258108b75e7081a965f0c60e1f2
parent9e259dd1ff3f146f89ff4261d9e48685b378b693 (diff)
downloadgcc-0f7866e7ba109bc68ae2c0d14ec0399765fc144b.zip
gcc-0f7866e7ba109bc68ae2c0d14ec0399765fc144b.tar.gz
gcc-0f7866e7ba109bc68ae2c0d14ec0399765fc144b.tar.bz2
c-common.c (flag_objc): New.
2002-08-09 Ziemowit Laski <zlaski@apple.com> * c-common.c (flag_objc): New. * c-common.h (c_language_kind): Get rid of clk_objective_c enum value. (flag_objc): New extern declaration. * c-decl.c (implicitly_declare): Call objc_check_decl instead of maybe_objc_check_decl. (finish_decl): Likewise. (grokfield): Likewise. (finish_struct): Likewise. * c-lang.c (maybe_objc_check_decl): Rename to objc_check_decl. (maybe_objc_comptypes): Rename to objc_comptypes. (maybe_building_objc_message_expr): Rename to objc_message_selector. * c-lex.c (lex_charconst): Remove uses of clk_objective_c, replace with flag_objc as needed. * c-opts.c (c_common_init_options): Likewise. (c_common_decode_option): Likewise. * c-parse.in (init_reswords): Likewise. * c-tree.h (maybe_objc_check_decl): Rename to objc_check_decl. (maybe_objc_comptypes): Rename to objc_comptypes. (maybe_building_objc_message_expr): Rename to objc_message_selector. * c-typeck.c (comptypes): Call objc_comptypes instead of maybe_objc_comptypes, and/or objc_message_selector instead of (comp_target_types): Likewise. (convert_for_assignment): Likewise. (warn_for_assignment): Likewise. * cppinit.c (init_builtins): Set __OBJC__ manifest constant independently of those for other languages. * objc/objc-act.c (maybe_objc_comptypes): Delete. (maybe_objc_check_decl): Delete. (maybe_building_objc_message_expr): Rename to objc_message_selector. * objc/objc-lang.c (objc_init_options): Use clk_c instead of clk_objective_c; set flag_objc flag. From-SVN: r56173
-rw-r--r--gcc/ChangeLog39
-rw-r--r--gcc/c-common.c3
-rw-r--r--gcc/c-common.h10
-rw-r--r--gcc/c-decl.c26
-rw-r--r--gcc/c-lang.c6
-rw-r--r--gcc/c-lex.c3
-rw-r--r--gcc/c-opts.c23
-rw-r--r--gcc/c-parse.in2
-rw-r--r--gcc/c-tree.h6
-rw-r--r--gcc/c-typeck.c11
-rw-r--r--gcc/cppinit.c8
-rw-r--r--gcc/objc/objc-act.c17
-rw-r--r--gcc/objc/objc-lang.c5
13 files changed, 98 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7666364..df1380c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+2002-08-09 Ziemowit Laski <zlaski@apple.com>
+
+ * c-common.c (flag_objc): New.
+ * c-common.h (c_language_kind): Get rid of clk_objective_c
+ enum value.
+ (flag_objc): New extern declaration.
+ * c-decl.c (implicitly_declare): Call objc_check_decl
+ instead of maybe_objc_check_decl.
+ (finish_decl): Likewise.
+ (grokfield): Likewise.
+ (finish_struct): Likewise.
+ * c-lang.c (maybe_objc_check_decl): Rename to objc_check_decl.
+ (maybe_objc_comptypes): Rename to objc_comptypes.
+ (maybe_building_objc_message_expr): Rename to
+ objc_message_selector.
+ * c-lex.c (lex_charconst): Remove uses of clk_objective_c,
+ replace with flag_objc as needed.
+ * c-opts.c (c_common_init_options): Likewise.
+ (c_common_decode_option): Likewise.
+ * c-parse.in (init_reswords): Likewise.
+ * c-tree.h (maybe_objc_check_decl): Rename to objc_check_decl.
+ (maybe_objc_comptypes): Rename to objc_comptypes.
+ (maybe_building_objc_message_expr): Rename to
+ objc_message_selector.
+ * c-typeck.c (comptypes): Call objc_comptypes instead of
+ maybe_objc_comptypes, and/or objc_message_selector instead of
+ maybe_building_objc_message_expr.
+ (comp_target_types): Likewise.
+ (convert_for_assignment): Likewise.
+ (warn_for_assignment): Likewise.
+ * cppinit.c (init_builtins): Set __OBJC__ manifest constant
+ independently of those for other languages.
+ * objc/objc-act.c (maybe_objc_comptypes): Delete.
+ (maybe_objc_check_decl): Delete.
+ (maybe_building_objc_message_expr): Rename to
+ objc_message_selector.
+ * objc/objc-lang.c (objc_init_options): Use clk_c instead of
+ clk_objective_c; set flag_objc flag.
+
2002-08-09 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
* ifcvt.c (find_if_case_2): Test correct basic block for size.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e09eac2..bdf47c4 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -200,6 +200,9 @@ int flag_preprocess_only;
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;
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 6544694..63a6837 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -240,8 +240,7 @@ 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 */
+ clk_cplusplus /* ANSI/ISO C++ */
}
c_language_kind;
@@ -367,7 +366,6 @@ struct c_lang_decl GTY(()) {
extern c_language_kind c_language;
-
/* Switches common to the C front ends. */
/* Nonzero if prepreprocessing only. */
@@ -377,6 +375,9 @@ extern int flag_preprocess_only;
user's namespace. */
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. */
extern int flag_undef;
@@ -794,9 +795,6 @@ extern int warn_deprecated;
extern int max_tinst_depth;
-
-
-
/* C types are partitioned into three subsets: object, function, and
incomplete types. */
#define C_TYPE_OBJECT_P(type) \
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 7344292..7a926cf 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2059,8 +2059,9 @@ implicitly_declare (functionid)
So we record the decl in the standard fashion. */
pushdecl (decl);
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
+ /* This is a no-op in c-lang.c or something real in objc-act.c. */
+ if (flag_objc)
+ objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, 0, 0);
@@ -3097,8 +3098,9 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
{
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
+ /* This is a no-op in c-lang.c or something real in objc-act.c. */
+ if (flag_objc)
+ objc_check_decl (decl);
if (!DECL_CONTEXT (decl))
{
@@ -3160,8 +3162,9 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == TYPE_DECL)
{
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
+ /* This is a no-op in c-lang.c or something real in objc-act.c. */
+ if (flag_objc)
+ objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, DECL_CONTEXT (decl) == 0, 0);
}
@@ -5009,7 +5012,8 @@ grokfield (filename, line, declarator, declspecs, width)
finish_decl (value, NULL_TREE, NULL_TREE);
DECL_INITIAL (value) = width;
- maybe_objc_check_decl (value);
+ if (flag_objc)
+ objc_check_decl (value);
return value;
}
@@ -5297,8 +5301,9 @@ finish_struct (t, fieldlist, attributes)
&& TREE_CODE (decl) != TYPE_DECL)
{
layout_decl (decl, 0);
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
+ /* This is a no-op in c-lang.c or something real in objc-act.c. */
+ if (flag_objc)
+ objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, toplevel, 0);
if (! toplevel)
expand_decl (decl);
@@ -5320,7 +5325,8 @@ finish_struct (t, fieldlist, attributes)
if (TREE_CODE (decl) != TYPE_DECL)
{
layout_decl (decl, 0);
- maybe_objc_check_decl (decl);
+ if (flag_objc)
+ objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, toplevel, 0);
if (! toplevel)
expand_decl (decl);
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index e305483..7d256ab 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -183,13 +183,13 @@ is_class_name (arg)
}
void
-maybe_objc_check_decl (decl)
+objc_check_decl (decl)
tree decl ATTRIBUTE_UNUSED;
{
}
int
-maybe_objc_comptypes (lhs, rhs, reflexive)
+objc_comptypes (lhs, rhs, reflexive)
tree lhs ATTRIBUTE_UNUSED;
tree rhs ATTRIBUTE_UNUSED;
int reflexive ATTRIBUTE_UNUSED;
@@ -198,7 +198,7 @@ maybe_objc_comptypes (lhs, rhs, reflexive)
}
tree
-maybe_building_objc_message_expr ()
+objc_message_selector ()
{
return 0;
}
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index bf5c424..b4cc301 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -1078,8 +1078,7 @@ lex_charconst (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 || c_language == clk_objective_c)
- || chars_seen > 1)
+ else if ((c_language == clk_c) || chars_seen > 1)
type = integer_type_node;
else
type = char_type_node;
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 9f25343..02f1ada 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -406,11 +406,11 @@ c_common_init_options (lang)
#endif
c_language = lang;
- parse_in = cpp_create_reader (lang == clk_c || lang == clk_objective_c
+ parse_in = cpp_create_reader (lang == clk_c
? CLK_GNUC89 : CLK_GNUCXX);
cpp_opts = cpp_get_options (parse_in);
- if (lang == clk_objective_c)
+ if (flag_objc)
cpp_opts->objc = 1;
flag_const_strings = (lang == clk_cplusplus);
@@ -447,9 +447,14 @@ c_common_decode_option (argc, argv)
switch (c_language)
{
- case clk_c: lang_flag = CL_C_ONLY; break;
- case clk_cplusplus: lang_flag = CL_CXX_ONLY; break;
- case clk_objective_c: lang_flag = CL_OBJC_ONLY; break;
+ case clk_c: lang_flag = (flag_objc
+ ? CL_C
+ : CL_C_ONLY);
+ break;
+ case clk_cplusplus: lang_flag = (flag_objc
+ ? CL_CXX
+ : CL_CXX_ONLY);
+ break;
default: abort ();
}
@@ -557,7 +562,7 @@ c_common_decode_option (argc, argv)
if (warn_uninitialized != 1)
warn_uninitialized = (on ? 2 : 0);
- if (c_language == clk_c || c_language == clk_objective_c)
+ 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 = on * 2;
@@ -813,7 +818,7 @@ c_common_decode_option (argc, argv)
break;
case OPT_Wwrite_strings:
- if (c_language == clk_c || c_language == clk_objective_c)
+ if (c_language == clk_c)
flag_const_strings = on;
else
warn_write_strings = on;
@@ -824,7 +829,7 @@ c_common_decode_option (argc, argv)
break;
case OPT_fcond_mismatch:
- if (c_language == clk_c || c_language == clk_objective_c)
+ if (c_language == clk_c)
{
flag_cond_mismatch = on;
break;
@@ -1114,7 +1119,7 @@ c_common_decode_option (argc, argv)
case OPT_std_iso9899_199409:
case OPT_ansi:
/* Note: -ansi is used by both the C and C++ front ends. */
- if (c_language == clk_c || c_language == clk_objective_c)
+ if (c_language == clk_c)
{
flag_no_asm = 1;
flag_writable_strings = 0;
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index b726f5a..11e0e44 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -3546,7 +3546,7 @@ init_reswords ()
int mask = (flag_isoc99 ? 0 : D_C89)
| (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
- if (c_language != clk_objective_c)
+ if (!flag_objc)
mask |= D_OBJC;
/* It is not necessary to register ridpointers as a GC root, because
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 74133b3..c92f1f1 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -165,10 +165,10 @@ struct lang_type GTY(())
/* in c-lang.c and objc-act.c */
extern tree lookup_interface PARAMS ((tree));
extern tree is_class_name PARAMS ((tree));
-extern void maybe_objc_check_decl PARAMS ((tree));
+extern void objc_check_decl PARAMS ((tree));
extern void finish_file PARAMS ((void));
-extern int maybe_objc_comptypes PARAMS ((tree, tree, int));
-extern tree maybe_building_objc_message_expr PARAMS ((void));
+extern int objc_comptypes PARAMS ((tree, tree, int));
+extern tree objc_message_selector PARAMS ((void));
extern int recognize_objc_keyword PARAMS ((void));
extern tree lookup_objc_ivar PARAMS ((tree));
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index e9c846e..dedb72f 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -568,7 +568,7 @@ comptypes (type1, type2)
}
case RECORD_TYPE:
- if (maybe_objc_comptypes (t1, t2, 0) == 1)
+ if (flag_objc && objc_comptypes (t1, t2, 0) == 1)
val = 1;
break;
@@ -588,7 +588,7 @@ comp_target_types (ttl, ttr)
int val;
/* Give maybe_objc_comptypes a crack at letting these types through. */
- if ((val = maybe_objc_comptypes (ttl, ttr, 1)) >= 0)
+ if ((val = objc_comptypes (ttl, ttr, 1)) >= 0)
return val;
val = comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (ttl)),
@@ -3985,7 +3985,8 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
overflow_warning (rhs);
/* Check for Objective-C protocols. This will issue a warning if
there are protocol violations. No need to use the return value. */
- maybe_objc_comptypes (type, rhstype, 0);
+ if (flag_objc)
+ objc_comptypes (type, rhstype, 0);
return rhs;
}
@@ -4213,7 +4214,7 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
{
if (funname)
{
- tree selector = maybe_building_objc_message_expr ();
+ tree selector = objc_message_selector ();
if (selector && parmnum > 2)
error ("incompatible type for argument %d of `%s'",
@@ -4271,7 +4272,7 @@ warn_for_assignment (msgid, opname, function, argnum)
{
if (opname == 0)
{
- tree selector = maybe_building_objc_message_expr ();
+ tree selector = objc_message_selector ();
char * new_opname;
if (selector && argnum > 2)
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index b7d204c..212da6b 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -694,16 +694,16 @@ init_builtins (pfile)
if (CPP_OPTION (pfile, cplusplus))
_cpp_define_builtin (pfile, "__cplusplus 1");
- else if (CPP_OPTION (pfile, objc))
- _cpp_define_builtin (pfile, "__OBJC__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
-
- if (CPP_OPTION (pfile, lang) == CLK_STDC94)
+ else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
+ if (CPP_OPTION (pfile, objc))
+ _cpp_define_builtin (pfile, "__OBJC__ 1");
+
if (pfile->cb.register_builtins)
(*pfile->cb.register_builtins) (pfile);
}
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index c16e57c..44edf72 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -518,14 +518,6 @@ define_decl (declarator, declspecs)
`a' and `b' are the same class type, or
`a' and `b' are of class types A and B such that B is a descendant of A. */
-int
-maybe_objc_comptypes (lhs, rhs, reflexive)
- tree lhs, rhs;
- int reflexive;
-{
- return objc_comptypes (lhs, rhs, reflexive);
-}
-
static tree
lookup_method_in_protocol_list (rproto_list, sel_name, class_meth)
tree rproto_list;
@@ -764,13 +756,6 @@ objc_check_decl (decl)
error_with_decl (decl, "`%s' cannot be statically allocated");
}
-void
-maybe_objc_check_decl (decl)
- tree decl;
-{
- objc_check_decl (decl);
-}
-
/* Implement static typing. At this point, we know we have an interface. */
tree
@@ -4690,7 +4675,7 @@ receiver_is_class_object (receiver)
static tree building_objc_message_expr = 0;
tree
-maybe_building_objc_message_expr ()
+objc_message_selector ()
{
return building_objc_message_expr;
}
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 111428a..73e6204 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -162,5 +162,6 @@ const char * const tree_code_name[] = {
static void
objc_init_options ()
{
- c_common_init_options (clk_objective_c);
-}
+ flag_objc = 1;
+ c_common_init_options (clk_c);
+}