]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[CPP PATCH] Fix warning & other cleanups.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Aug 2018 15:28:15 +0000 (15:28 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Aug 2018 15:28:15 +0000 (15:28 +0000)
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html
* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
(cpp_fun_like_macro_p): Make inline, define.
* macro.c (cpp_define_lazily): Use UCHAR_MAX.
(cpp_fun_like_macro_p): Delete.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263666 138bc75d-0d04-0410-961f-82ee72b054a4

libcpp/ChangeLog
libcpp/directives.c
libcpp/include/cpplib.h
libcpp/macro.c

index 19d89b1722718216ca24d33efed5c975a9d0e5a8..01cc250867827b598ade5a0607b92ad07031297d 100644 (file)
@@ -1,5 +1,11 @@
 2018-08-20  Nathan Sidwell  <nathan@acm.org>
 
+       * directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
+       * include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
+       (cpp_fun_like_macro_p): Make inline, define.
+       * macro.c (cpp_define_lazily): Use UCHAR_MAX.
+       (cpp_fun_like_macro_p): Delete.
+
        * Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
        * include/cpp-id-data.h: Delete.
        * internal.h: Include cpplib.h not cpp-id-data.h.
index e75462f1c0d6460b2e18a52e7a0040f7390e44bc..f04ed7cf2c1f51755860909908d71d31ad1e25db 100644 (file)
@@ -665,12 +665,12 @@ do_undef (cpp_reader *pfile)
 
       /* 6.10.3.5 paragraph 2: [#undef] is ignored if the specified
         identifier is not currently defined as a macro name.  */
-      if (node->type == NT_MACRO)
+      if (cpp_macro_p (node))
        {
          if (node->flags & NODE_WARN)
            cpp_error (pfile, CPP_DL_WARNING,
                       "undefining \"%s\"", NODE_NAME (node));
-         else if ((node->flags & NODE_BUILTIN)
+         else if (cpp_builtin_macro_p (node)
                   && CPP_OPTION (pfile, warn_builtin_macro_redefined))
            cpp_warning_with_line (pfile, CPP_W_BUILTIN_MACRO_REDEFINED,
                                   pfile->directive_line, 0,
index d446fb1e48c1441fc94f6ff416c5644eaeeee6ab..b784e0facd07f994b02f7c900383f2445f44f583 100644 (file)
@@ -674,7 +674,7 @@ struct cpp_dir
 enum cpp_macro_kind {
   cmk_macro,   /* An ISO macro (token expansion).  */
   cmk_assert,   /* An assertion.  */
-  cmk_traditional,     /* A traditional macro (text expansion).  */
+  cmk_traditional      /* A traditional macro (text expansion).  */
 };
 
 /* Each macro definition is recorded in a cpp_macro structure.
@@ -972,7 +972,10 @@ inline bool cpp_macro_p (const cpp_hashnode *node)
   return node->type == NT_MACRO;
 }
 /* Returns true if NODE is a function-like user macro.  */
-extern bool cpp_fun_like_macro_p (cpp_hashnode *node);
+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 *);
index 0f9e25d3b98f773efc1ae315a187fde5046caaae..123f63d11771ea46c4f4cabd430e6f59116a6801 100644 (file)
@@ -3551,7 +3551,7 @@ cpp_define_lazily (cpp_reader *pfile, cpp_hashnode *node, unsigned num)
 {
   cpp_macro *macro = node->value.macro;
 
-  gcc_checking_assert (pfile->cb.user_lazy_macro && macro && num < 255);
+  gcc_checking_assert (pfile->cb.user_lazy_macro && macro && num < UCHAR_MAX);
 
   macro->lazy = num + 1;
 }
@@ -3632,15 +3632,6 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
     }
 }
 
-/* Returns true of NODE is a function-like macro.  */
-bool
-cpp_fun_like_macro_p (cpp_hashnode *node)
-{
-  return (node->type == NT_MACRO
-         && (node->flags & (NODE_BUILTIN | NODE_MACRO_ARG)) == 0
-         && 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".