]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move NODE_BUILTIN to NT_BUILTIN.
authorNathan Sidwell <nathan@acm.org>
Wed, 8 Aug 2018 15:42:27 +0000 (15:42 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 8 Aug 2018 15:42:27 +0000 (15:42 +0000)
gcc/c-family/
* c-ppoutput.c (cb_used_define): Use cpp_macro_p.
gcc/cp/
* name-lookup.c (lookup_name_fuzzy): Use cpp_macro_p.
libcpp/
* directives.c (do_undef): Adjust macro detection.
(undefine_macros): Adjust.
(do_pragma_poison, do_ifndef, do_ifdef, cpp_pop_definition):
Adjust.
* expr.c (parse_defined): Adjust.
* files.c (should_stack_file): Adjust.
* identifiers.c (cpp_defined): Adjust.
* include/cpplib.h (NODE_BUILTIN): Delete.
(enum node_type): Add NT_BUILTIN.
(CPP_HASHNODE_VALUE_IDX): Adjust.
* init.c (cpp_init_special_builtins): Adjust.
* internal.h (_cpp_mark_macro, _cpp_maybe_lazy_macro): Adjust.
* lex.c (is_macro): Adjust.
* macro.c (struct macro_arg_saved_data): Add type field.
(_cpp_warn_if_unused_macro): Adjust.
(enter_macro_context, cpp_get_token_1, warn_of_redefinition)
(_cpp_free_defintion, _cpp_safe_parameter)
(_cpp_unsave_parameters, _cpp_create_definition): Adjust.
(cpp_macro_p): Adjust.
* pch.c (write_macdef, count_defs, write_defs, cpp_validate_state)
(save_macros): Adjust.
* traditional.c (fun_like_macro, maybe_start_funlike)
(_cpp_scan_out_logical_line, push_replacement_text): Adjust.

From-SVN: r263425

14 files changed:
ChangeLog.name-lookup
gcc/c-family/c-ppoutput.c
gcc/cp/name-lookup.c
libcpp/directives.c
libcpp/expr.c
libcpp/files.c
libcpp/identifiers.c
libcpp/include/cpplib.h
libcpp/init.c
libcpp/internal.h
libcpp/lex.c
libcpp/macro.c
libcpp/pch.c
libcpp/traditional.c

index 00c5da1fdd6d73df54a5562d059c3274852b6cb1..03437a968a84d1520e9e24ba1cca1744c570f2c0 100644 (file)
@@ -1,3 +1,35 @@
+2018-08-08  Nathan Sidwell  <nathan@acm.org>
+
+       Move NODE_BUILTIN to NT_BUILTIN.
+       gcc/c-family/
+       * c-ppoutput.c (cb_used_define): Use cpp_macro_p.
+       gcc/cp/
+       * name-lookup.c (lookup_name_fuzzy): Use cpp_macro_p.
+       libcpp/
+       * directives.c (do_undef): Adjust macro detection.
+       (undefine_macros): Adjust.
+       (do_pragma_poison, do_ifndef, do_ifdef, cpp_pop_definition):
+       Adjust.
+       * expr.c (parse_defined): Adjust.
+       * files.c (should_stack_file): Adjust.
+       * identifiers.c (cpp_defined): Adjust.
+       * include/cpplib.h (NODE_BUILTIN): Delete.
+       (enum node_type): Add NT_BUILTIN.
+       (CPP_HASHNODE_VALUE_IDX): Adjust.
+       * init.c (cpp_init_special_builtins): Adjust.
+       * internal.h (_cpp_mark_macro, _cpp_maybe_lazy_macro): Adjust.
+       * lex.c (is_macro): Adjust.
+       * macro.c (struct macro_arg_saved_data): Add type field.
+       (_cpp_warn_if_unused_macro): Adjust.
+       (enter_macro_context, cpp_get_token_1, warn_of_redefinition)
+       (_cpp_free_defintion, _cpp_safe_parameter)
+       (_cpp_unsave_parameters, _cpp_create_definition): Adjust.
+       (cpp_macro_p): Adjust.
+       * pch.c (write_macdef, count_defs, write_defs, cpp_validate_state)
+       (save_macros): Adjust.
+       * traditional.c (fun_like_macro, maybe_start_funlike)
+       (_cpp_scan_out_logical_line, push_replacement_text): Adjust.
+
 2018-08-07  Nathan Sidwell  <nathan@acm.org>
 
        Move NODE_MACRO_ARG to NT_MACRO_ARG.
index 65f0d774ccd537eeddecfa74ee4c336bfddb1fe7..9be72da1dd8e1bd51c434bb0caca93bbe3972d94 100644 (file)
@@ -532,13 +532,14 @@ static void
 cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED,
                cpp_hashnode *node)
 {
-  macro_queue *q;
-  if (node->flags & NODE_BUILTIN)
-    return;
-  q = XNEW (macro_queue);
-  q->macro = xstrdup ((const char *) cpp_macro_definition (pfile, node));
-  q->next = define_queue;
-  define_queue = q;
+  if (cpp_macro_p (node))
+    {
+      macro_queue *q;
+      q = XNEW (macro_queue);
+      q->macro = xstrdup ((const char *) cpp_macro_definition (pfile, node));
+      q->next = define_queue;
+      define_queue = q;
+    }
 }
 
 static void
index a485e52a82522adc7c7a3c1ff38ef95d6932b104..87304b9aa6a114e889f30183a89280d613be2bfb 100644 (file)
@@ -5926,7 +5926,7 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc)
         macro was used with the wrong argument count, or the macro
         has been used before it was defined.  */
       cpp_hashnode *macro = bmm.blithely_get_best_candidate ();
-      if (macro && (macro->flags & NODE_BUILTIN) == 0)
+      if (macro && cpp_macro_p (macro))
        return name_hint (NULL,
                          macro_use_before_def::maybe_make (loc, macro));
     }
index 79497a828a7b9dc7b81cc722e11a14d7f1799080..7c707b70d87cdcc3af2b4a359a7ef2f807df6707 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 (node->type & NT_MACRO)
        {
          if (node->flags & NODE_WARN)
            cpp_error (pfile, CPP_DL_WARNING,
                       "undefining \"%s\"", NODE_NAME (node));
-         else if ((node->flags & NODE_BUILTIN)
+         else if ((node->type == NT_BUILTIN)
                   && CPP_OPTION (pfile, warn_builtin_macro_redefined))
            cpp_warning_with_line (pfile, CPP_W_BUILTIN_MACRO_REDEFINED,
                                   pfile->directive_line, 0,
@@ -695,7 +695,8 @@ undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h,
   /* Body of _cpp_free_definition inlined here for speed.
      Macros and assertions no longer have anything to free.  */
   h->type = NT_VOID;
-  h->flags &= ~(NODE_POISONED|NODE_BUILTIN|NODE_DISABLED|NODE_USED);
+  h->flags &= ~(NODE_POISONED|NODE_DISABLED|NODE_USED);
+  h->value.macro = NULL;
   return 1;
 }
 
@@ -1665,7 +1666,7 @@ do_pragma_poison (cpp_reader *pfile)
       if (hp->flags & NODE_POISONED)
        continue;
 
-      if (hp->type == NT_MACRO)
+      if (hp->type & NT_MACRO)
        cpp_error (pfile, CPP_DL_WARNING, "poisoning existing macro \"%s\"",
                   NODE_NAME (hp));
       _cpp_free_definition (hp);
@@ -1959,15 +1960,16 @@ do_ifdef (cpp_reader *pfile)
             the powerpc and spu ports using conditional macros for 'vector',
             'bool', and 'pixel' to act as conditional keywords.  This messes
             up tests like #ifndef bool.  */
-         skip = (node->type != NT_MACRO
+         skip = (node->type == NT_VOID
                  || ((node->flags & NODE_CONDITIONAL) != 0));
          _cpp_mark_macro_used (node);
          if (!(node->flags & NODE_USED))
            {
              node->flags |= NODE_USED;
-             if (node->type == NT_MACRO)
+             if (node->type & NT_MACRO)
                {
-                 _cpp_maybe_lazy_macro (pfile, node);
+                 if (node->type == NT_MACRO)
+                   _cpp_maybe_lazy_macro (pfile, node);
                  if (pfile->cb.used_define)
                    pfile->cb.used_define (pfile, pfile->directive_line, node);
                }
@@ -2003,15 +2005,16 @@ do_ifndef (cpp_reader *pfile)
             the powerpc and spu ports using conditional macros for 'vector',
             'bool', and 'pixel' to act as conditional keywords.  This messes
             up tests like #ifndef bool.  */
-         skip = (node->type == NT_MACRO
+         skip = (node->type != NT_VOID
                  && ((node->flags & NODE_CONDITIONAL) == 0));
          _cpp_mark_macro_used (node);
          if (!(node->flags & NODE_USED))
            {
              node->flags |= NODE_USED;
-             if (node->type == NT_MACRO)
+             if (node->type & NT_MACRO)
                {
-                 _cpp_maybe_lazy_macro (pfile, node);
+                 if (node->type == NT_MACRO)
+                   _cpp_maybe_lazy_macro (pfile, node);
                  if (pfile->cb.used_define)
                    pfile->cb.used_define (pfile, pfile->directive_line, node);
                }
@@ -2484,18 +2487,20 @@ cpp_pop_definition (cpp_reader *pfile, struct def_pragma_macro *c)
   if (pfile->cb.before_define)
     pfile->cb.before_define (pfile);
 
-  if (node->type == NT_MACRO)
+  if (node->type & NT_MACRO)
     {
       if (pfile->cb.undef)
        pfile->cb.undef (pfile, pfile->directive_line, node);
       if (CPP_OPTION (pfile, warn_unused_macros))
        _cpp_warn_if_unused_macro (pfile, node, NULL);
     }
+
   if (node->type != NT_VOID)
     _cpp_free_definition (node);
 
   if (c->is_undef)
     return;
+
   {
     size_t namelen;
     const uchar *dn;
@@ -2506,8 +2511,6 @@ cpp_pop_definition (cpp_reader *pfile, struct def_pragma_macro *c)
     h = cpp_lookup (pfile, c->definition, namelen);
     dn = c->definition + namelen;
 
-    h->type = NT_VOID;
-    h->flags &= ~(NODE_POISONED|NODE_BUILTIN|NODE_DISABLED|NODE_USED);
     nbuf = cpp_push_buffer (pfile, dn, ustrchr (dn, '\n') - dn, true);
     if (nbuf != NULL)
       {
index b752d4f92ad88c71643eda5ab5a6b605d8bc511f..58d65d50ac30ed2c2ea1452d27b67c39a46e57a7 100644 (file)
@@ -1068,9 +1068,10 @@ parse_defined (cpp_reader *pfile)
       if (!(node->flags & NODE_USED))
        {
          node->flags |= NODE_USED;
-         if (node->type == NT_MACRO)
+         if (node->type & NT_MACRO)
            {
-             _cpp_maybe_lazy_macro (pfile, node);
+             if (node->type == NT_MACRO)
+               _cpp_maybe_lazy_macro (pfile, node);
              if (pfile->cb.used_define)
                pfile->cb.used_define (pfile, pfile->directive_line, node);
            }
@@ -1095,7 +1096,7 @@ parse_defined (cpp_reader *pfile)
   result.unsignedp = false;
   result.high = 0;
   result.overflow = false;
-  result.low = (node && node->type == NT_MACRO
+  result.low = (node && node->type & NT_MACRO
                && (node->flags & NODE_CONDITIONAL) == 0);
   return result;
 }
index e8d21b28e6278283d3915ddabafeb436a74b6f61..cb044fce690ed576991f57aacf7593d8cccf58a6 100644 (file)
@@ -805,7 +805,7 @@ should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
 
   /* Skip if the file had a header guard and the macro is defined.
      PCH relies on this appearing before the PCH handler below.  */
-  if (file->cmacro && file->cmacro->type == NT_MACRO)
+  if (file->cmacro && file->cmacro->type & NT_MACRO)
     return false;
 
   /* Handle PCH files immediately; don't stack them.  */
index 16584a6ab8ab8b08dce7a5342c0fb3b3dec12a8a..675194d2122cb9b2bd5235215ea6d175d839d8b7 100644 (file)
@@ -104,8 +104,8 @@ cpp_defined (cpp_reader *pfile, const unsigned char *str, int len)
 
   node = CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_NO_INSERT));
 
-  /* If it's of type NT_MACRO, it cannot be poisoned.  */
-  return node && node->type == NT_MACRO;
+  /* If it's a macro, it cannot be poisoned.  */
+  return node && node->type & NT_MACRO;
 }
 
 /* We don't need a proxy since the hash table's identifier comes first
index 27a17e8ae81c8f4971d6e1d86eea817efaf87ee3..8a96b7174b28741ab7d5c092ffa4f8b69884b8a2 100644 (file)
@@ -686,11 +686,11 @@ struct cpp_dir
 /* Hash node flags.  */
 #define NODE_OPERATOR  (1 << 0)        /* C++ named operator.  */
 #define NODE_POISONED  (1 << 1)        /* Poisoned identifier.  */
-#define NODE_BUILTIN   (1 << 2)        /* Builtin macro.  */
+
 #define NODE_DIAGNOSTIC (1 << 3)       /* Possible diagnostic when lexed.  */
 #define NODE_WARN      (1 << 4)        /* Warn if redefined or undefined.  */
 #define NODE_DISABLED  (1 << 5)        /* A disabled macro.  */
-//#define NODE_MACRO_ARG       (1 << 6)        /* Used during #define processing.  */
+
 #define NODE_USED      (1 << 7)        /* Dumped with -dU.  */
 #define NODE_CONDITIONAL (1 << 8)      /* Conditional macro */
 #define NODE_WARN_OPERATOR (1 << 9)    /* Warn about C++ named operator.  */
@@ -700,8 +700,8 @@ enum node_type
 {
   NT_VOID = 0,    /* No definition yet.  */
   NT_MACRO_ARG,           /* A macro arg.  */
-  NT_MACRO,       /* A macro or assert.  */
-  NT_BUILTIN,     /* A builtin macro.  */
+  NT_MACRO,       /* A user macro or assert.  */
+  NT_BUILTIN      /* A builtin macro.  */
 };
 
 /* Different flavors of builtin macro.  _Pragma is an operator, but we
@@ -736,7 +736,7 @@ enum {
 
 #define CPP_HASHNODE_VALUE_IDX(HNODE)                          \
   ((HNODE).type == NT_MACRO_ARG ? NTV_ARGUMENT                 \
-   : (HNODE).flags & NODE_BUILTIN ? NTV_BUILTIN                        \
+   : (HNODE).type == NT_BUILTIN ? NTV_BUILTIN                  \
    : NTV_MACRO)
 
 /* The common part of an identifier node shared amongst all 3 C front
index d1697fdec1c440b8e1b10aaca8fcde16c541faef..1f6a2bb1b799a04627d0ac5731e23ee2153ce083 100644 (file)
@@ -480,8 +480,7 @@ cpp_init_special_builtins (cpp_reader *pfile)
              || pfile->cb.has_attribute == NULL))
        continue;
       cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
-      hp->type = NT_MACRO;
-      hp->flags |= NODE_BUILTIN;
+      hp->type = NT_BUILTIN;
       if (b->always_warn_if_redefined)
        hp->flags |= NODE_WARN;
       hp->value.builtin = (enum cpp_builtin_type) b->value;
index 9186aedbf77cc6b8b3a2187e22eae20d0f4e20b6..c4df933c898bdfd86cbb76cbbfb573dbff7160ad 100644 (file)
@@ -94,7 +94,7 @@ struct dummy
 #define CPP_ALIGN(size) CPP_ALIGN2 (size, DEFAULT_ALIGNMENT)
 
 #define _cpp_mark_macro_used(NODE) do {                                        \
-  if ((NODE)->type == NT_MACRO && !((NODE)->flags & NODE_BUILTIN))     \
+  if ((NODE)->type == NT_MACRO)                \
     (NODE)->value.macro->used = 1; } while (0)
 
 /* A generic memory buffer, and operations on it.  */
@@ -625,8 +625,8 @@ cpp_in_primary_file (cpp_reader *pfile)
 extern cpp_macro *_cpp_do_lazy_macro (cpp_reader *pfile, cpp_macro *macro);
 inline cpp_macro *_cpp_maybe_lazy_macro (cpp_reader *pfile, cpp_hashnode *node)
 {
-  cpp_macro *macro = (node->flags & NODE_BUILTIN) ? NULL : node->value.macro;
-  if (macro && macro->lazy)
+  cpp_macro *macro = node->value.macro;
+  if (macro->lazy)
     macro = _cpp_do_lazy_macro (pfile, macro);
   return macro;
 }
index 6e60f88fafa308c527bf76b213bda3bd2b7e44fe..1f6fe687173d41d71aabfc06ae7b01a85be99162 100644 (file)
@@ -1627,7 +1627,7 @@ is_macro(cpp_reader *pfile, const uchar *base)
   cpp_hashnode *result = CPP_HASHNODE (ht_lookup_with_hash (pfile->hash_table,
                                        base, cur - base, hash, HT_NO_INSERT));
 
-  return !result ? false : (result->type == NT_MACRO);
+  return result ? result->type & NT_MACRO : false;
 }
 
 /* Returns true if a literal suffix does not have the expected form
index 5bc31d0623319210dfd7222abe98ce3461d2bcb8..80b90f4ff44ef5f005c81f85722fdf5f4dce4325 100644 (file)
@@ -85,8 +85,9 @@ struct macro_arg_token_iter
 struct macro_arg_saved_data {
   /* The canonical (UTF-8) spelling of this identifier.  */
   cpp_hashnode *canonical_node;
-  /* The previous value of this identifier.  */
+  /* The previous value & type of this identifier.  */
   union _cpp_hashnode_value value;
+  node_type type;
 };
 
 static const char *vaopt_paste_error =
@@ -341,7 +342,7 @@ int
 _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
                           void *v ATTRIBUTE_UNUSED)
 {
-  if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
+  if (node->type == NT_MACRO)
     {
       cpp_macro *macro = node->value.macro;
 
@@ -1273,7 +1274,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
      function where set this flag to FALSE.  */
   pfile->about_to_expand_macro_p = true;
 
-  if (!(node->flags & NODE_BUILTIN))
+  if (node->type == NT_MACRO)
     {
       cpp_macro *macro = _cpp_maybe_lazy_macro (pfile, node);
       _cpp_buff *pragma_buff = NULL;
@@ -1404,7 +1405,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
 
     if (/* The top-level macro invocation that triggered the expansion
           we are looking at is with a standard macro ...  */
-       !(pfile->top_most_macro_node->flags & NODE_BUILTIN)
+       pfile->top_most_macro_node->type == NT_MACRO
        /* ... and it's a function-like macro invocation,  */
        && pfile->top_most_macro_node->value.macro->fun_like
        /* ... and we are tracking the macro expansion.  */
@@ -2736,7 +2737,7 @@ cpp_get_token_1 (cpp_reader *pfile, source_location *location)
 
       node = result->val.node.node;
 
-      if (node->type != NT_MACRO || (result->flags & NO_EXPAND))
+      if (node->type == NT_VOID || (result->flags & NO_EXPAND))
        break;
 
       if (!(node->flags & NODE_DISABLED))
@@ -2994,7 +2995,7 @@ warn_of_redefinition (cpp_reader *pfile, cpp_hashnode *node,
 
   /* Suppress warnings for builtins that lack the NODE_WARN flag,
      unless Wbuiltin-macro-redefined.  */
-  if (node->flags & NODE_BUILTIN)
+  if (node->type == NT_BUILTIN)
     return CPP_OPTION (pfile, warn_builtin_macro_redefined);
 
   /* Redefinitions of conditional (context-sensitive) macros, on
@@ -3039,8 +3040,7 @@ _cpp_free_definition (cpp_hashnode *h)
 {
   /* Macros and assertions no longer have anything to free.  */
   h->type = NT_VOID;
-  /* Clear builtin flag in case of redefinition.  */
-  h->flags &= ~(NODE_BUILTIN | NODE_DISABLED | NODE_USED);
+  h->flags &= ~(NODE_DISABLED | NODE_USED);
   h->value.macro = NULL;
 }
 
@@ -3068,8 +3068,9 @@ _cpp_save_parameter (cpp_reader *pfile, unsigned n, cpp_hashnode *node,
     }
   
   macro_arg_saved_data *saved = (macro_arg_saved_data *)pfile->macro_buffer;
-  saved[n].value = node->value;
   saved[n].canonical_node = node;
+  saved[n].value = node->value;
+  saved[n].type = node->type;
 
   void *base = _cpp_reserve_room (pfile, n * sizeof (cpp_hashnode *),
                                  sizeof (cpp_hashnode *));
@@ -3095,9 +3096,8 @@ _cpp_unsave_parameters (cpp_reader *pfile, unsigned n)
        &((struct macro_arg_saved_data *) pfile->macro_buffer)[n];
 
       struct cpp_hashnode *node = save->canonical_node;
+      node->type = save->type;
       node->value = save->value;
-      node->type = (node->flags & NODE_BUILTIN || node->value.macro
-                   ? NT_MACRO : NT_VOID);
     }
 }
 
@@ -3505,14 +3505,14 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
   if (!macro)
     return false;
 
-  if (node->type == NT_MACRO)
+  if (node->type & NT_MACRO)
     {
       if (CPP_OPTION (pfile, warn_unused_macros))
        _cpp_warn_if_unused_macro (pfile, node, NULL);
 
       if (warn_of_redefinition (pfile, node, macro))
        {
-          const int reason = ((node->flags & NODE_BUILTIN)
+          const int reason = ((node->type == NT_BUILTIN)
                              && !(node->flags & NODE_WARN))
                              ? CPP_W_BUILTIN_MACRO_REDEFINED : CPP_W_NONE;
 
@@ -3521,7 +3521,7 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
                                      pfile->directive_line, 0,
                                      "\"%s\" redefined", NODE_NAME (node));
 
-         if (warned && node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
+         if (warned && node->type == NT_MACRO)
            cpp_error_with_line (pfile, CPP_DL_NOTE,
                                 node->value.macro->line, 0,
                         "this is the location of the previous definition");
@@ -3615,11 +3615,13 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
 bool
 cpp_macro_p (cpp_hashnode *node, bool builtin_ok)
 {
-  if (node->type != NT_MACRO)
-    return false;
-  if (node->flags & NODE_BUILTIN)
+  if (node->type == NT_BUILTIN)
     return builtin_ok;
-  return node->value.macro->kind != cmk_assert;
+
+  if (node->type == NT_MACRO)
+    return node->value.macro->kind != cmk_assert;
+
+  return false;
 }
 
 /* Returns true if NODE is a function-like macro.  */
index 63022818e01c2a43c820a891c68dd4aa9b8222a2..d75f5694c4899795d9cf7d7eebe9e99a8d5012f8 100644 (file)
@@ -59,9 +59,11 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
       is_void = true;
       goto poisoned;
 
+    case NT_BUILTIN:
+      return 1;
+
     case NT_MACRO:
-      if (!(hn->flags & NODE_BUILTIN)
-         && hn->value.macro->kind != cmk_assert)
+      if (hn->value.macro->kind != cmk_assert)
        {
        poisoned:
          struct macrodef_struct s;
@@ -223,9 +225,10 @@ count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
 
   switch (hn->type)
     {
+    case NT_BUILTIN:
+      return 1;
+
     case NT_MACRO:
-      if (hn->flags & NODE_BUILTIN)
-       return 1;
       if (hn->value.macro->kind == cmk_assert)
        return 1;
 
@@ -260,9 +263,10 @@ write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
 
   switch (hn->type)
     {
+    case NT_BUILTIN:
+      return 1;
+
     case NT_MACRO:
-      if (hn->flags & NODE_BUILTIN)
-       return 1;
       if (hn->value.macro->kind == cmk_assert)
        return 1;
 
@@ -614,7 +618,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
          goto fail;
        }
 
-      if (h->type != NT_MACRO)
+      if (h->type == NT_VOID)
        {
          /* It's ok if __GCC_HAVE_DWARF2_CFI_ASM becomes undefined,
             as in, when the PCH file is created with -g and we're
@@ -752,7 +756,6 @@ save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p)
   struct save_macro_data *data = (struct save_macro_data *)data_p;
 
   if (h->type == NT_MACRO
-      && !(h->flags & NODE_BUILTIN)
       && h->value.macro->kind != cmk_assert)
     {
       if (data->count == data->array_size)
index 3e24b648174c09039736ffb0cb2e4197983625a0..b64b65fc3daefd21b1e588e08a2892e2e425a088 100644 (file)
@@ -325,7 +325,7 @@ _cpp_read_logical_line_trad (cpp_reader *pfile)
 static inline bool
 fun_like_macro (cpp_hashnode *node)
 {
-  if (node->flags & NODE_BUILTIN)
+  if (node->type == NT_BUILTIN)
     return node->value.builtin == BT_HAS_ATTRIBUTE;
   else
     return node->value.macro->fun_like;
@@ -338,7 +338,7 @@ maybe_start_funlike (cpp_reader *pfile, cpp_hashnode *node, const uchar *start,
                     struct fun_macro *macro)
 {
   unsigned int n;
-  if (node->flags & NODE_BUILTIN)
+  if (node->type == NT_BUILTIN)
     n = 1;
   else
     n = node->value.macro->paramc;
@@ -521,7 +521,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
              out = pfile->out.cur;
              cur = CUR (context);
 
-             if (node->type == NT_MACRO
+             if (node->type & NT_MACRO
                  /* Should we expand for ls_answer?  */
                  && (lex_state == ls_none || lex_state == ls_fun_open)
                  && !pfile->state.prevent_expansion)
@@ -610,7 +610,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
              paren_depth--;
              if (lex_state == ls_fun_close && paren_depth == 0)
                {
-                 if (fmacro.node->flags & NODE_BUILTIN)
+                 if (fmacro.node->type == NT_BUILTIN)
                    {
                      /* Handle builtin function-like macros like
                         __has_attribute.  The already parsed arguments
@@ -839,7 +839,7 @@ push_replacement_text (cpp_reader *pfile, cpp_hashnode *node)
   const uchar *text;
   uchar *buf;
 
-  if (node->flags & NODE_BUILTIN)
+  if (node->type == NT_BUILTIN)
     {
       text = _cpp_builtin_macro_text (pfile, node);
       len = ustrlen (text);