This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ bootstrap (part 12/n): Import enum cpp_ttype.
- From: Bernardo Innocenti <bernie at develer dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Jul 2004 00:43:50 +0200
- Subject: C++ bootstrap (part 12/n): Import enum cpp_ttype.
- Organization: Develer S.r.l.
Hello,
I've not yet committed this bit because I was unsure of any
unwanted consequences of this change. c-pragma.h appeared
to avoid libcpp.h intentionally.
Needless to say, C++ has typed enums so we can't mix them as
freely as in C. The alternative would be adding lots of
casts everywhere.
Is this part OK?
2004-07-26 Bernardo Innocenti <bernie@develer.com>
* Makefile.in (C_PRAGMA_H): New variable to track dependencies
of c-pragma.h.
* c-pragma.h (c_lex, c_lex_with_flags): Change returntype to
enum cpp_ttype.
* c-lex.c: Likewise.
diff -u -p -r1.1316 Makefile.in
--- gcc/Makefile.in 1 Jul 2004 04:08:57 -0000 1.1316
+++ gcc/Makefile.in 11 Jul 2004 23:56:53 -0000
@@ -710,6 +710,7 @@ GGC_H = ggc.h gtype-desc.h
TIMEVAR_H = timevar.h timevar.def
INSN_ATTR_H = insn-attr.h $(srcdir)/insn-addr.h $(srcdir)/varray.h
C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H)
+C_PRAGMA_H = c-pragma.h $(CPPLIB_H)
C_TREE_H = c-tree.h $(C_COMMON_H)
SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h
PREDICT_H = predict.h predict.def
@@ -1358,7 +1359,7 @@ c-incpath.o: c-incpath.c c-incpath.h $(C
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) function.h output.h \
$(EXPR_H) debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) \
- opts.h c-pragma.h gt-c-decl.h cgraph.h $(HASHTAB_H) libfuncs.h except.h \
+ opts.h $(C_PRAGMA_H) gt-c-decl.h cgraph.h $(HASHTAB_H) libfuncs.h except.h \
$(LANGHOOKS_DEF_H) $(TREE_DUMP_H)
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
$(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H) \
@@ -1370,10 +1371,10 @@ stub-objc.o : stub-objc.c $(CONFIG_H) $(
$(GGC_H) $(C_COMMON_H)
c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) real.h c-incpath.h cppdefault.h \
- c-pragma.h input.h intl.h $(FLAGS_H) toplev.h output.h \
+ $(C_PRAGMA_H) input.h intl.h $(FLAGS_H) toplev.h output.h \
$(CPPLIB_H) $(EXPR_H) $(TM_P_H)
c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(srcdir)/../libcpp/internal.h $(TM_P_H) c-pragma.h
+ $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(srcdir)/../libcpp/internal.h $(TM_P_H) $(C_PRAGMA_H)
c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) $(C_TREE_H) \
$(FLAGS_H) toplev.h tree-inline.h $(DIAGNOSTIC_H) $(VARRAY_H) \
@@ -1383,7 +1384,7 @@ c-aux-info.o : c-aux-info.c $(CONFIG_H)
c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(FLAGS_H) toplev.h $(C_COMMON_H) real.h
c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) function.h c-pragma.h toplev.h output.h $(GGC_H) $(TM_P_H) \
+ $(TREE_H) function.h $(C_PRAGMA_H) toplev.h output.h $(GGC_H) $(TM_P_H) \
$(C_COMMON_H) $(TARGET_H) gt-c-pragma.h
graph.o: graph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(FLAGS_H) output.h \
$(RTL_H) function.h hard-reg-set.h $(BASIC_BLOCK_H) graph.h
@@ -1410,7 +1411,7 @@ tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB
# A file used by all variants of C.
c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) toplev.h output.h c-pragma.h intl.h \
+ $(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) toplev.h output.h $(C_PRAGMA_H) intl.h \
$(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \
$(DIAGNOSTIC_H) gt-c-common.h langhooks.h varray.h $(RTL_H) \
$(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h
@@ -1419,34 +1420,34 @@ c-pretty-print.o : c-pretty-print.c $(C_
$(DIAGNOSTIC_H)
c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) c-pragma.h $(FLAGS_H) toplev.h langhooks.h \
+ $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
tree-inline.h $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) \
opts.h options.h $(PARAMS_H) $(MKDEPS_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) version.h $(C_COMMON_H) c-pragma.h $(FLAGS_H) toplev.h \
+ $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h \
langhooks.h output.h except.h real.h $(TARGET_H) $(TM_P_H)
# A file used by all variants of C and some other languages.
attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(FLAGS_H) \
- toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) $(EXPR_H) $(TM_P_H) \
+ toplev.h output.h $(C_PRAGMA_H) $(RTL_H) $(GGC_H) $(EXPR_H) $(TM_P_H) \
builtin-types.def $(TARGET_H) langhooks.h
c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
$(C_COMMON_H) $(FLAGS_H) toplev.h intl.h $(DIAGNOSTIC_H)
c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
+ $(C_TREE_H) $(FLAGS_H) toplev.h output.h $(C_PRAGMA_H) $(RTL_H) $(GGC_H) \
$(EXPR_H) $(PREDICT_H) tree-inline.h
c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(TREE_DUMP_H)
c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \
- $(C_COMMON_H) output.h toplev.h c-pragma.h $(GGC_H) debug.h \
+ $(C_COMMON_H) output.h toplev.h $(C_PRAGMA_H) $(GGC_H) debug.h \
langhooks.h $(FLAGS_H) hosthooks.h version.h $(TARGET_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
@@ -1570,7 +1571,7 @@ tree.o : tree.c $(CONFIG_H) $(SYSTEM_H)
toplev.h $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \
real.h gt-tree.h tree-iterator.h $(BASIC_BLOCK_H) $(TREE_FLOW_H)
tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) langhooks.h toplev.h output.h c-pragma.h $(RTL_H) \
+ $(C_TREE_H) $(FLAGS_H) langhooks.h toplev.h output.h $(C_PRAGMA_H) $(RTL_H) \
$(GGC_H) $(EXPR_H) $(SPLAY_TREE_H) $(TREE_DUMP_H) tree-iterator.h
tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h insn-config.h \
@@ -1779,7 +1780,7 @@ errors.o : errors.c $(CONFIG_H) $(SYSTEM
varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
$(FLAGS_H) function.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
- output.h c-pragma.h toplev.h xcoffout.h debug.h $(GGC_H) $(TM_P_H) \
+ output.h $(C_PRAGMA_H) toplev.h xcoffout.h debug.h $(GGC_H) $(TM_P_H) \
$(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h real.h
function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(CFGLAYOUT_H) \
diff -u -p -r1.40 c-pragma.h
--- gcc/c-pragma.h 15 Jun 2004 21:43:20 -0000 1.40
+++ gcc/c-pragma.h 11 Jul 2004 23:57:07 -0000
@@ -22,6 +22,8 @@ Software Foundation, 59 Temple Place - S
#ifndef GCC_C_PRAGMA_H
#define GCC_C_PRAGMA_H
+#include <cpplib.h> /* For enum cpp_ttype. */
+
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
extern int yydebug;
@@ -54,8 +56,8 @@ extern void maybe_apply_pragma_weak (tre
extern tree maybe_apply_renaming_pragma (tree, tree);
extern void add_to_renaming_pragma_list (tree, tree);
-extern int c_lex (tree *);
-extern int c_lex_with_flags (tree *, unsigned char *);
+extern enum cpp_ttype c_lex (tree *);
+extern enum cpp_ttype c_lex_with_flags (tree *, unsigned char *);
/* If 1, then lex strings into the execution character set.
If 0, lex strings into the host character set.
diff -u -p -r1.223 c-lex.c
--- gcc/c-lex.c 30 Jun 2004 18:05:03 -0000 1.223
+++ gcc/c-lex.c 11 Jul 2004 23:57:05 -0000
@@ -336,7 +336,7 @@ get_nonpadding_token (void)
return tok;
}
-int
+enum cpp_ttype
c_lex_with_flags (tree *value, unsigned char *cpp_flags)
{
const cpp_token *tok;
@@ -454,7 +454,7 @@ c_lex_with_flags (tree *value, unsigned
return tok->type;
}
-int
+enum cpp_ttype
c_lex (tree *value)
{
return c_lex_with_flags (value, NULL);
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/