From: Nathan Sidwell Date: Wed, 8 Aug 2018 20:53:00 +0000 (+0000) Subject: Fold cpp-id-data.h into cpplib.h X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae56543c58944f1b1c4c782f05db39ce3448c27d;p=thirdparty%2Fgcc.git Fold cpp-id-data.h into cpplib.h Fold cpp-id-data.h into cpplib.h libcpp/ * internal.h: Include cpplib.h, not cpp-id-data.h. (uchar, UC): From cpp-id-data.h. * include/cpplib.h (cpp_macro_kind, cpp_macro): From cpp-id-data.h. * include.cpp-id-data.h: Delete. * Makefile.in (TAGS_SOURCES): Drop cpp-id-data.h. gcc/ * Makefile.in (CPP_ID_DATA_H): Delete. (CPP_INTERNAL_H): Drop CPP_ID_DATA_H. (GT_FILES): Replace CPP_ID_DATA_H with CPPLIB_H. * cppbuiltin.c: Include cpplib.h instead of cpp-id-data.h. gcc/c-family * c-ada-spec.c: Don't include cpp-id-data.h. * c-cppbuiltin.h: Likewise. From-SVN: r263434 --- diff --git a/ChangeLog.name-lookup b/ChangeLog.name-lookup index 1b5ad7695021..0642783247ea 100644 --- a/ChangeLog.name-lookup +++ b/ChangeLog.name-lookup @@ -1,5 +1,21 @@ 2018-08-08 Nathan Sidwell + Fold cpp-id-data.h into cpplib.h + libcpp/ + * internal.h: Include cpplib.h, not cpp-id-data.h. + (uchar, UC): From cpp-id-data.h. + * include/cpplib.h (cpp_macro_kind, cpp_macro): From cpp-id-data.h. + * include.cpp-id-data.h: Delete. + * Makefile.in (TAGS_SOURCES): Drop cpp-id-data.h. + gcc/ + * Makefile.in (CPP_ID_DATA_H): Delete. + (CPP_INTERNAL_H): Drop CPP_ID_DATA_H. + (GT_FILES): Replace CPP_ID_DATA_H with CPPLIB_H. + * cppbuiltin.c: Include cpplib.h instead of cpp-id-data.h. + gcc/c-family + * c-ada-spec.c: Don't include cpp-id-data.h. + * c-cppbuiltin.h: Likewise. + libcpp/ * include/cpplib.h (enum node_type): Rename to NT_USER_MACR, NT_BUILTIN_MACRO. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e7d818d174c8..e8697816a975 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -978,8 +978,7 @@ CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h OPTS_H = $(INPUT_H) $(VEC_H) opts.h $(OBSTACK_H) SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H) -CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h -CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H) +CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) $(DUMPFILE_H) TREE_PASS_H = tree-pass.h $(TIMEVAR_H) $(DUMPFILE_H) TREE_SSA_H = tree-ssa.h tree-ssa-operands.h \ @@ -2522,7 +2521,7 @@ s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd generic-match.c $(STAMP) s-match -GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ +GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(host_xm_file_list) \ $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \ $(srcdir)/wide-int.h $(srcdir)/alias.h \ diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index d987effe72b8..3fe8138796e7 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see #include "c-ada-spec.h" #include "fold-const.h" #include "c-pragma.h" -#include "cpp-id-data.h" #include "stringpool.h" #include "attribs.h" diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 54d9c8996bab..96a6b4dfd2b9 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see #include "output.h" /* For user_label_prefix. */ #include "debug.h" /* For dwarf2out_do_cfi_asm. */ #include "common/common-target.h" -#include "cpp-id-data.h" #include "cppbuiltin.h" #ifndef TARGET_OS_CPP_BUILTINS diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c index de8cd339404f..8b9ec5de912d 100644 --- a/gcc/cppbuiltin.c +++ b/gcc/cppbuiltin.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "version.h" #include "flags.h" -#include "cpp-id-data.h" +#include "cpplib.h" #include "cppbuiltin.h" diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 0db5528e6323..4339456e9c67 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1721,7 +1721,7 @@ open_base_files (void) "tree-vrp.h", "tree-phinodes.h", "ssa-iterators.h", "stringpool.h", "tree-ssanames.h", "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h", "tree-ssa-loop-manip.h", "tree-ssa-loop-niter.h", "tree-into-ssa.h", - "tree-dfa.h", "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", + "tree-dfa.h", "tree-ssa.h", "reload.h", "cpplib.h", "tree-chrec.h", "except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h", "target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h", "ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "omp-offload.h", NULL diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in index bfd6069c2506..835c835183fe 100644 --- a/libcpp/Makefile.in +++ b/libcpp/Makefile.in @@ -261,9 +261,8 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES) sed 's:$(srcdir)/::g' po/$(PACKAGE).pot rm po/$(PACKAGE).pot.tmp -TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \ - include/line-map.h include/symtab.h include/cpp-id-data.h \ - include/cpplib.h include/mkdeps.h system.h +TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h system.h ucnid.h \ + include/cpplib.h include/line-map.h include/mkdeps.h include/symtab.h TAGS: $(TAGS_SOURCES) cd $(srcdir) && etags $(TAGS_SOURCES) diff --git a/libcpp/include/cpp-id-data.h b/libcpp/include/cpp-id-data.h index 24572d2cd67d..d2fc4b6d6fd3 100644 --- a/libcpp/include/cpp-id-data.h +++ b/libcpp/include/cpp-id-data.h @@ -16,81 +16,3 @@ along with this program; see the file COPYING3. If not see . */ #include "cpplib.h" - -#if !defined (HAVE_UCHAR) && !defined (IN_GCC) -typedef unsigned char uchar; -#endif - -#define UC (const unsigned char *) /* Intended use: UC"string" */ - -/* The kind of the cpp_macro. */ -enum cpp_macro_kind { - cmk_macro, /* An ISO macro (token expansion). */ - cmk_assert, /* An assertion. */ - cmk_traditional, /* A traditional macro (text expansion). */ -}; - -/* Each macro definition is recorded in a cpp_macro structure. - Variadic macros cannot occur with traditional cpp. */ -struct GTY(()) cpp_macro { - union cpp_parm_u - { - /* Parameters, if any. If parameter names use extended identifiers, - the original spelling of those identifiers, not the canonical - UTF-8 spelling, goes here. */ - cpp_hashnode ** GTY ((tag ("false"), - nested_ptr (union tree_node, - "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", - "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), - length ("%1.paramc"))) params; - - /* If this is an assertion, the next one in the chain. */ - cpp_macro *GTY ((tag ("true"))) next; - } GTY ((desc ("%1.kind == cmk_assert"))) parm; - - /* Definition line number. */ - source_location line; - - /* Number of tokens in body, or bytes for traditional macros. */ - /* Do we really need 2^32-1 range here? */ - unsigned int count; - - /* Number of parameters. */ - unsigned short paramc; - - /* Non-zero if this is a user-lazy macro, value provided by user. */ - unsigned char lazy; - - /* The kind of this macro (ISO, trad or assert) */ - unsigned kind : 2; - - /* If a function-like macro. */ - unsigned int fun_like : 1; - - /* If a variadic macro. */ - unsigned int variadic : 1; - - /* If macro defined in system header. */ - unsigned int syshdr : 1; - - /* Nonzero if it has been expanded or had its existence tested. */ - unsigned int used : 1; - - /* Indicate whether the tokens include extra CPP_PASTE tokens at the - end to track invalid redefinitions with consecutive CPP_PASTE - tokens. */ - unsigned int extra_tokens : 1; - - /* 1 bits spare (32-bit). 33 on 64-bit target. */ - - union cpp_exp_u - { - /* Trailing array of replacement tokens (ISO), or assertion body value. */ - cpp_token GTY ((tag ("false"), length ("%1.count"))) tokens[1]; - - /* Pointer to replacement text (traditional). See comment at top - of cpptrad.c for how traditional function-like macros are - encoded. */ - const unsigned char *GTY ((tag ("true"))) text; - } GTY ((desc ("%1.kind == cmk_traditional"))) exp; -}; diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 8630475995ec..8fd2e4c1b692 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -671,6 +671,78 @@ struct cpp_dir dev_t dev; }; +/* The kind of the cpp_macro. */ +enum cpp_macro_kind { + cmk_macro, /* An ISO macro (token expansion). */ + cmk_assert, /* An assertion. */ + cmk_traditional, /* A traditional macro (text expansion). */ +}; + +/* Each macro definition is recorded in a cpp_macro structure. + Variadic macros cannot occur with traditional cpp. */ +struct GTY(()) cpp_macro { + union cpp_parm_u + { + /* Parameters, if any. If parameter names use extended identifiers, + the original spelling of those identifiers, not the canonical + UTF-8 spelling, goes here. */ + cpp_hashnode ** GTY ((tag ("false"), + nested_ptr (union tree_node, + "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", + "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), + length ("%1.paramc"))) params; + + /* If this is an assertion, the next one in the chain. */ + cpp_macro *GTY ((tag ("true"))) next; + } GTY ((desc ("%1.kind == cmk_assert"))) parm; + + /* Definition line number. */ + source_location line; + + /* Number of tokens in body, or bytes for traditional macros. */ + /* Do we really need 2^32-1 range here? */ + unsigned int count; + + /* Number of parameters. */ + unsigned short paramc; + + /* Non-zero if this is a user-lazy macro, value provided by user. */ + unsigned char lazy; + + /* The kind of this macro (ISO, trad or assert) */ + unsigned kind : 2; + + /* If a function-like macro. */ + unsigned int fun_like : 1; + + /* If a variadic macro. */ + unsigned int variadic : 1; + + /* If macro defined in system header. */ + unsigned int syshdr : 1; + + /* Nonzero if it has been expanded or had its existence tested. */ + unsigned int used : 1; + + /* Indicate whether the tokens include extra CPP_PASTE tokens at the + end to track invalid redefinitions with consecutive CPP_PASTE + tokens. */ + unsigned int extra_tokens : 1; + + /* 1 bits spare (32-bit). 33 on 64-bit target. */ + + union cpp_exp_u + { + /* Trailing array of replacement tokens (ISO), or assertion body value. */ + cpp_token GTY ((tag ("false"), length ("%1.count"))) tokens[1]; + + /* Pointer to replacement text (traditional). See comment at top + of cpptrad.c for how traditional function-like macros are + encoded. */ + const unsigned char *GTY ((tag ("true"))) text; + } GTY ((desc ("%1.kind == cmk_traditional"))) exp; +}; + /* The structure of a node in the hash table. The hash table has entries for all identifiers: either macros defined by #define commands (type NT_MACRO), assertions created with #assert diff --git a/libcpp/internal.h b/libcpp/internal.h index d63a3db9a3c5..59f830c6a8e5 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -23,7 +23,7 @@ along with this program; see the file COPYING3. If not see #define LIBCPP_INTERNAL_H #include "symtab.h" -#include "cpp-id-data.h" +#include "cpplib.h" #if HAVE_ICONV #include @@ -602,6 +602,12 @@ extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; #endif +#if !defined (HAVE_UCHAR) && !defined (IN_GCC) +typedef unsigned char uchar; +#endif + +#define UC (const uchar *) /* Intended use: UC"string" */ + /* Macros. */ static inline int cpp_in_system_header (cpp_reader *);