]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move NODE_MACRO_ARG to NT_MACRO_ARG.
authorNathan Sidwell <nathan@acm.org>
Tue, 7 Aug 2018 12:10:18 +0000 (12:10 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 7 Aug 2018 12:10:18 +0000 (12:10 +0000)
libcpp/
* include/libcpp.h (NODE_MACRO_ARG): Delete.
(enum node_type): Add NT_MACRO_ARG.
(CPP_HSHNODE_VALUE_IDX): Adjust.
* macro.c (_cpp_save_parameter, _cpp_unsave_parameter): Adjust.
(lex_expansion_token): Likewise.
* traditional.c (_cpp_scan_out_logical_line): Likewise.

From-SVN: r263356

ChangeLog.name-lookup
libcpp/include/cpplib.h
libcpp/macro.c
libcpp/traditional.c

index 7a9977135519db019d1ca624be71c1df8c295fcd..00c5da1fdd6d73df54a5562d059c3274852b6cb1 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-07  Nathan Sidwell  <nathan@acm.org>
+
+       Move NODE_MACRO_ARG to NT_MACRO_ARG.
+       libcpp/
+       * include/libcpp.h (NODE_MACRO_ARG): Delete.
+       (enum node_type): Add NT_MACRO_ARG.
+       (CPP_HSHNODE_VALUE_IDX): Adjust.
+       * macro.c (_cpp_save_parameter, _cpp_unsave_parameter): Adjust.
+       (lex_expansion_token): Likewise.
+       * traditional.c (_cpp_scan_out_logical_line): Likewise.
+
 2018-08-06  Nathan Sidwell  <nathan@acm.org>
 
        Macro laziness now a property of cpp_macro.
index 2f24afcc1e459d92843b1140e03d6744346ef16f..27a17e8ae81c8f4971d6e1d86eea817efaf87ee3 100644 (file)
@@ -690,7 +690,7 @@ struct cpp_dir
 #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_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.  */
@@ -699,7 +699,9 @@ struct cpp_dir
 enum node_type
 {
   NT_VOID = 0,    /* No definition yet.  */
-  NT_MACRO        /* A macro or assert.  */
+  NT_MACRO_ARG,           /* A macro arg.  */
+  NT_MACRO,       /* A macro or assert.  */
+  NT_BUILTIN,     /* A builtin macro.  */
 };
 
 /* Different flavors of builtin macro.  _Pragma is an operator, but we
@@ -733,7 +735,7 @@ enum {
 };
 
 #define CPP_HASHNODE_VALUE_IDX(HNODE)                          \
-  ((HNODE).flags & NODE_MACRO_ARG ? NTV_ARGUMENT               \
+  ((HNODE).type == NT_MACRO_ARG ? NTV_ARGUMENT                 \
    : (HNODE).flags & NODE_BUILTIN ? NTV_BUILTIN                        \
    : NTV_MACRO)
 
index 72f223f7356efe5764c3487fa91cd57fc31bfa8f..5bc31d0623319210dfd7222abe98ce3461d2bcb8 100644 (file)
@@ -3052,7 +3052,7 @@ _cpp_save_parameter (cpp_reader *pfile, unsigned n, cpp_hashnode *node,
                     cpp_hashnode *spelling)
 {
   /* Constraint 6.10.3.6 - duplicate parameter names.  */
-  if (node->flags & NODE_MACRO_ARG)
+  if (node->type == NT_MACRO_ARG)
     {
       cpp_error (pfile, CPP_DL_ERROR, "duplicate macro parameter \"%s\"",
                 NODE_NAME (node));
@@ -3076,7 +3076,7 @@ _cpp_save_parameter (cpp_reader *pfile, unsigned n, cpp_hashnode *node,
   ((cpp_hashnode **)base)[n++] = spelling;
 
   /* Morph into a macro arg.  */
-  node->flags |= NODE_MACRO_ARG;
+  node->type = NT_MACRO_ARG;
   /* Index is 1 based.  */
   node->value.arg_index = n;
 
@@ -3095,8 +3095,9 @@ _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->flags &= ~ NODE_MACRO_ARG;
       node->value = save->value;
+      node->type = (node->flags & NODE_BUILTIN || node->value.macro
+                   ? NT_MACRO : NT_VOID);
     }
 }
 
@@ -3235,8 +3236,7 @@ lex_expansion_token (cpp_reader *pfile, cpp_macro *macro)
   pfile->cur_token = saved_cur_token;
 
   /* Is this a parameter?  */
-  if (token->type == CPP_NAME
-      && (token->val.node.node->flags & NODE_MACRO_ARG) != 0)
+  if (token->type == CPP_NAME && token->val.node.node->type == NT_MACRO_ARG)
     {
       /* Morph into a parameter reference.  */
       cpp_hashnode *spelling = token->val.node.spelling;
index 7f374dd32b26e0a4b3c79966d5e6a7a4391a9594..3e24b648174c09039736ffb0cb2e4197983625a0 100644 (file)
@@ -545,7 +545,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
                      goto new_context;
                    }
                }
-             else if (macro && (node->flags & NODE_MACRO_ARG) != 0)
+             else if (macro && node->type == NT_MACRO_ARG)
                {
                  /* Found a parameter in the replacement text of a
                     #define.  Remove its name from the output.  */