summaryrefslogtreecommitdiffstats
path: root/gcc/objc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/Make-lang.in5
-rw-r--r--gcc/objc/lang-specs.h2
-rw-r--r--gcc/objc/objc-act.c51
3 files changed, 33 insertions, 25 deletions
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in
index 41a29efcd04..7ece7058925 100644
--- a/gcc/objc/Make-lang.in
+++ b/gcc/objc/Make-lang.in
@@ -68,7 +68,7 @@ objc-parse.o : $(srcdir)/objc/objc-parse.c \
$(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/c-common.h \
$(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
- $(srcdir)/objc/objc-act.h system.h
+ $(srcdir)/objc/objc-act.h system.h cpplib.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-parse.c
@@ -88,8 +88,7 @@ objc-act.o : $(srcdir)/objc/objc-act.c \
$(CONFIG_H) $(TREE_H) $(RTL_H) system.h \
$(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \
$(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \
- $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h \
- $(srcdir)/c-parse.h
+ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-act.c
diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h
index ccd91940116..d6d50e0663a 100644
--- a/gcc/objc/lang-specs.h
+++ b/gcc/objc/lang-specs.h
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
{".m", "@objective-c"},
{"@objective-c",
#if USE_CPPLIB
- "%{E|M|MM:cpp0 -lang-objc %{ansi:-std=c89} %(cpp_options)}\
+ "%{E|M|MM:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)}\
%{!E:%{!M:%{!MM:cc1obj -lang-objc %(cpp_options) %(cc1_options) %{gen-decls}\
%{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
as %(asm_options) %{!pipe:%g.s} %A }}}}}"
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index fd358a981b5..ba5837ad9f8 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -56,7 +56,6 @@ Boston, MA 02111-1307, USA. */
#if USE_CPPLIB
#include "cpplib.h"
extern cpp_reader parse_in;
-extern cpp_options parse_options;
#endif
/* This is the default way of generating a method name. */
@@ -137,7 +136,6 @@ char *util_firstobj;
/* for encode_method_def */
#include "rtl.h"
-#include "c-parse.h"
#define OBJC_VERSION (flag_next_runtime ? 5 : 8)
#define PROTOCOL_VERSION 2
@@ -693,17 +691,12 @@ generate_struct_by_value_array ()
exit (0);
}
-#if USE_CPPLIB
-extern char *yy_cur;
-#endif
-
void
lang_init_options ()
{
#if USE_CPPLIB
+ cpp_init ();
cpp_reader_init (&parse_in);
- parse_in.opts = &parse_options;
- cpp_options_init (&parse_options);
#endif
}
@@ -715,16 +708,11 @@ lang_init ()
With luck, we discover the real source file's name from that
and put it in input_filename. */
ungetc (check_newline (), finput);
-#else
- check_newline ();
- yy_cur--;
-#endif
-
- /* The line number can be -1 if we had -g3 and the input file
- had a directive specifying line 0. But we want predefined
- functions to have a line number of 0, not -1. */
- if (lineno == -1)
- lineno = 0;
+#endif
+ /* Force the line number back to 0; check_newline will have
+ raised it to 1, which will make the builtin functions appear
+ not to be built in. */
+ lineno = 0;
/* If gen_declaration desired, open the output file. */
if (flag_gen_declaration)
@@ -800,9 +788,7 @@ lang_decode_option (argc, argv)
{
const char *p = argv[0];
- if (!strcmp (p, "-lang-objc"))
- c_language = clk_objective_c;
- else if (!strcmp (p, "-gen-decls"))
+ if (!strcmp (p, "-gen-decls"))
flag_gen_declaration = 1;
else if (!strcmp (p, "-Wselector"))
warn_selector = 1;
@@ -8632,3 +8618,26 @@ lookup_objc_ivar (id)
else
return 0;
}
+
+/* Parser callbacks. */
+void
+forget_protocol_qualifiers ()
+{
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_IN]) = 0;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_OUT]) = 0;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_INOUT]) = 0;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_BYCOPY]) = 0;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_BYREF]) = 0;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_ONEWAY]) = 0;
+}
+
+void
+remember_protocol_qualifiers ()
+{
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_IN]) = 1;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_OUT]) = 1;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_INOUT]) = 1;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_BYCOPY]) = 1;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_BYREF]) = 1;
+ C_IS_RESERVED_WORD (ridpointers[(int) RID_ONEWAY]) = 1;
+}
OpenPOWER on IntegriCloud