]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-ppoutput.c (dump_macro): No need to check for assert here.
authorNathan Sidwell <nathan@acm.org>
Thu, 9 Aug 2018 02:14:45 +0000 (02:14 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 9 Aug 2018 02:14:45 +0000 (02:14 +0000)
gcc/c-family/
c-ppoutput.c (dump_macro): No need to check for assert here.
libcpp/
* include/cpplib.h (cpp_user_macro_p): Check non-assertness here.
(cpp_fun_like_macro_p): Make inline.
* macro.c (enter_macro_context): Use it directly.
(cpp_fun_like_macro_p): Remove definition here.
* pch.c (save_macros): Not need to check assertness here.

From-SVN: r263440

ChangeLog.name-lookup
gcc/c-family/c-ppoutput.c
libcpp/include/cpplib.h
libcpp/macro.c
libcpp/pch.c

index b642cfbd48f9972014d8dc471f0584cb7f7aed60..9ed2faf0595832f87c8175820d704f45413c05e1 100644 (file)
@@ -1,5 +1,14 @@
 2018-08-08  Nathan Sidwell  <nathan@acm.org>
 
+       gcc/c-family/
+       c-ppoutput.c (dump_macro): No need to check for assert here.
+       libcpp/
+       * include/cpplib.h (cpp_user_macro_p): Check non-assertness here.
+       (cpp_fun_like_macro_p): Make inline.
+       * macro.c (enter_macro_context): Use it directly.
+       (cpp_fun_like_macro_p): Remove definition here.
+       * pch.c (save_macros): Not need to check assertness here.
+
        Merge trunk r263434.
 
        Fold cpp-id-data.h into cpplib.h
index b849227df593cfbff874cab0cc3fa9eb6b842a08..5b630b6e7ab4822a3931fb681b1cabc9f1c28639 100644 (file)
@@ -20,7 +20,7 @@
 #include "system.h"
 #include "coretypes.h"
 #include "c-common.h"          /* For flags.  */
-#include "../libcpp/internal.h"
+#include "../libcpp/internal.h" /* EW! */
 #include "c-pragma.h"          /* For parse_in.  */
 #include "file-prefix-map.h"    /* remap_macro_filename()  */
 
@@ -690,7 +690,7 @@ static int
 dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED)
 {
   /* asserts are distinguished by beginning with '#'.  */
-  if (cpp_user_macro_p (node) && NODE_NAME(node)[0] != '#')
+  if (cpp_user_macro_p (node))
     {
       fputs ("#define ", print.outf);
       fputs ((const char *) cpp_macro_definition (pfile, node),
index 8fd2e4c1b692d902fecac48728cf01f60a3a878b..8d224ad751e52f8fd021caee895a0154666ff675 100644 (file)
@@ -942,24 +942,29 @@ extern int cpp_avoid_paste (cpp_reader *, const cpp_token *,
 extern const cpp_token *cpp_get_token (cpp_reader *);
 extern const cpp_token *cpp_get_token_with_location (cpp_reader *,
                                                     source_location *);
-/* Although a macro may actually turn out to be an assert, they are
-   separated by namespace, in that the latter have special
-   '#'-starting names, that macros cannot have.  We don't have to
-   check that.  */
 inline bool cpp_user_macro_p (const cpp_hashnode *node)
 {
-  return node->type == NT_USER_MACRO;
+  return node->type == NT_USER_MACRO && node->value.macro->kind != cmk_assert;
 }
 inline bool cpp_builtin_macro_p (const cpp_hashnode *node)
 {
   return node->type == NT_BUILTIN_MACRO;
 }
+/* Although a macro may actually turn out to be an assert, they are
+   separated by namespace, in that the latter have special
+   '#'-starting names, that macros cannot have.  We don't have to
+   check that here.  */
 inline bool cpp_macro_p (const cpp_hashnode *node)
 {
   return node->type & NT_USER_MACRO;
 }
 
-extern bool cpp_fun_like_macro_p (cpp_hashnode *);
+/* Returns true if NODE is a function-like user macro.  */
+inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
+{
+  return cpp_user_macro_p (node) && node->value.macro->fun_like;
+}
+
 extern const unsigned char *cpp_macro_definition (cpp_reader *,
                                                  cpp_hashnode *);
 extern source_location cpp_macro_definition_location (cpp_hashnode *);
index 2d830160308a70773df94e5a3d5651083269bb22..910b6dcabfd94c0f8a9c3022086488c0607e3a65 100644 (file)
@@ -1400,10 +1400,8 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
     source_location expand_loc;
 
     if (/* The top-level macro invocation that triggered the expansion
-          we are looking at is with a standard macro ...  */
-       cpp_user_macro_p (pfile->top_most_macro_node)
-       /* ... and it's a function-like macro invocation,  */
-       && pfile->top_most_macro_node->value.macro->fun_like
+          we are looking at is with a function-like user macro ...  */
+       cpp_fun_like_macro_p (pfile->top_most_macro_node)
        /* ... and we are tracking the macro expansion.  */
        && CPP_OPTION (pfile, track_macro_expansion))
       /* Then the location of the end of the macro invocation is the
@@ -3639,13 +3637,6 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
     }
 }
 
-/* Returns true if NODE is a function-like macro.  */
-bool
-cpp_fun_like_macro_p (cpp_hashnode *node)
-{
-  return cpp_user_macro_p (node) && node->value.macro->fun_like;
-}
-
 /* Returns the name, arguments and expansion of a macro, in a format
    suitable to be read back in again, and therefore also for DWARF 2
    debugging info.  e.g. "PASTE(X, Y) X ## Y", or "MACNAME EXPANSION".
index de86dde1bfb783b11f3ac4f5bc86d392aeb2d8fe..04d7094b068faa3bef34423fb00b31ab72e9d2c8 100644 (file)
@@ -755,7 +755,7 @@ save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p)
 {
   struct save_macro_data *data = (struct save_macro_data *)data_p;
 
-  if (cpp_user_macro_p (h) && h->value.macro->kind != cmk_assert)
+  if (cpp_user_macro_p (h))
     {
       if (data->count == data->array_size)
        {