aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2018-08-17 12:04:13 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-08-17 12:04:13 +0000
commitc5d725c0a8da3b2227d119871e881d8a6e1bf600 (patch)
tree7350722280ba05e1042b098c9c42984d9569f9a9
parent0138492e7bdbb4949c940a501415b7bbf5ffb9b4 (diff)
downloadgcc-c5d725c0a8da3b2227d119871e881d8a6e1bf600.zip
gcc-c5d725c0a8da3b2227d119871e881d8a6e1bf600.tar.gz
gcc-c5d725c0a8da3b2227d119871e881d8a6e1bf600.tar.bz2
[PATCH] Move cpp_macro to cpplib.h
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01016.html libcpp/ * cpp-id-data.h (uchar, UC): Move to internal.h (struct cpp_macro): Move to cpplib.h. * internal.h (uchar, UC): From cpp-id-data.h. * include/cpplib.h (struct cpp_macro): From cpp-id-data.h. gcc/c-family/ * c-ada-spec.c: Don't #include "cpp-id-data.h" * c-cppbuiltin.c: Likewise. gcc/ * cppbuiltin.c: Include "cpplib.h", not "cpp-id-data.h". From-SVN: r263618
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-ada-spec.c1
-rw-r--r--gcc/c-family/c-cppbuiltin.c1
-rw-r--r--gcc/cppbuiltin.c2
-rw-r--r--libcpp/ChangeLog7
-rw-r--r--libcpp/include/cpp-id-data.h56
-rw-r--r--libcpp/include/cpplib.h51
-rw-r--r--libcpp/internal.h6
9 files changed, 74 insertions, 59 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db625dd..17545dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * cppbuiltin.c: Include "cpplib.h", not "cpp-id-data.h".
+
2018-08-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/86841
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 2ab5b44..93b1ba1 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * c-ada-spec.c: Don't #include "cpp-id-data.h"
+ * c-cppbuiltin.c: Likewise.
+
2018-08-17 Martin Liska <mliska@suse.cz>
* c.opt: Remove Warn, Init and Report for options with
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index c6447ab..0352932 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 4fcf3a6..85d79dc 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 7ea45c8..7591229 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/libcpp/ChangeLog b/libcpp/ChangeLog
index 5f087ec..978b32e 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * cpp-id-data.h (uchar, UC): Move to internal.h
+ (struct cpp_macro): Move to cpplib.h.
+ * internal.h (uchar, UC): From cpp-id-data.h.
+ * include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
+
2018-08-16 Nathan Sidwell <nathan@acm.org>
* internal.h (_cpp_save_parameter): Take parmno, not macro.
diff --git a/libcpp/include/cpp-id-data.h b/libcpp/include/cpp-id-data.h
index 0299984..fb073fa 100644
--- a/libcpp/include/cpp-id-data.h
+++ b/libcpp/include/cpp-id-data.h
@@ -17,12 +17,6 @@ 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" */
-
/* Chained list of answers to an assertion. */
struct GTY(()) answer {
struct answer *next;
@@ -30,53 +24,3 @@ struct GTY(()) answer {
cpp_token GTY ((length ("%h.count"))) first[1];
};
-/* Each macro definition is recorded in a cpp_macro structure.
- Variadic macros cannot occur with traditional cpp. */
-struct GTY(()) cpp_macro {
- /* 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 ((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 ("%h.paramc")))
- params;
-
- /* Replacement tokens (ISO) or replacement text (traditional). See
- comment at top of cpptrad.c for how traditional function-like
- macros are encoded. */
- union cpp_macro_u
- {
- cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens;
- const unsigned char * GTY ((tag ("1"))) text;
- } GTY ((desc ("%1.traditional"))) exp;
-
- /* Definition line number. */
- source_location line;
-
- /* Number of tokens in expansion, or bytes for traditional macros. */
- unsigned int count;
-
- /* Number of parameters. */
- unsigned short paramc;
-
- /* 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 which field of 'exp' is in use. */
- unsigned int traditional : 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;
-};
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 99992a2..2b3440d 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -671,6 +671,57 @@ struct cpp_dir
dev_t dev;
};
+/* Each macro definition is recorded in a cpp_macro structure.
+ Variadic macros cannot occur with traditional cpp. */
+struct GTY(()) cpp_macro {
+ /* 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 ((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 ("%h.paramc")))
+ params;
+
+ /* Replacement tokens (ISO) or replacement text (traditional). See
+ comment at top of cpptrad.c for how traditional function-like
+ macros are encoded. */
+ union cpp_macro_u
+ {
+ cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens;
+ const unsigned char * GTY ((tag ("1"))) text;
+ } GTY ((desc ("%1.traditional"))) exp;
+
+ /* Definition line number. */
+ source_location line;
+
+ /* Number of tokens in expansion, or bytes for traditional macros. */
+ unsigned int count;
+
+ /* Number of parameters. */
+ unsigned short paramc;
+
+ /* 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 which field of 'exp' is in use. */
+ unsigned int traditional : 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;
+};
+
/* 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 0012520..0c2395a 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -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 *);