OSDN Git Service

2003-02-12 Phil Edwards <pme@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / cpptrad.c
index 5063065..92c4ee3 100644 (file)
@@ -18,6 +18,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
@@ -597,12 +599,12 @@ scan_out_logical_line (pfile, macro)
                      goto new_context;
                    }
                }
-             else if (macro && node->arg_index)
+             else if (macro && (node->flags & NODE_MACRO_ARG) != 0)
                {
                  /* Found a parameter in the replacement text of a
                     #define.  Remove its name from the output.  */
                  pfile->out.cur = out_start;
-                 save_replacement_text (pfile, macro, node->arg_index);
+                 save_replacement_text (pfile, macro, node->value.arg_index);
                  out = pfile->out.base;
                }
              else if (lex_state == ls_hash)
@@ -655,6 +657,7 @@ scan_out_logical_line (pfile, macro)
                {
                  cpp_macro *m = fmacro.node->value.macro;
 
+                 m->used = 1;
                  lex_state = ls_none;
                  save_argument (&fmacro, out - pfile->out.base);
 
@@ -681,7 +684,10 @@ scan_out_logical_line (pfile, macro)
          break;
 
        case '#':
-         if (out - 1 == pfile->out.base && !pfile->state.in_directive)
+         if (out - 1 == pfile->out.base
+             /* A '#' from a macro doesn't start a directive.  */
+             && !pfile->context->prev
+             && !pfile->state.in_directive)
            {
              /* A directive.  With the way _cpp_handle_directive
                 currently works, we only want to call it if either we
@@ -704,12 +710,13 @@ scan_out_logical_line (pfile, macro)
                {
                  bool do_it = false;
 
-                 if (is_numstart (*cur))
+                 if (is_numstart (*cur)
+                     && CPP_OPTION (pfile, lang) != CLK_ASM)
                    do_it = true;
                  else if (is_idstart (*cur))
                    /* Check whether we know this directive, but don't
                       advance.  */
-                   do_it = lex_identifier (pfile, cur)->directive_index != 0;
+                   do_it = lex_identifier (pfile, cur)->is_directive;
 
                  if (do_it || CPP_OPTION (pfile, lang) != CLK_ASM)
                    {
@@ -789,6 +796,7 @@ push_replacement_text (pfile, node)
   else
     {
       cpp_macro *macro = node->value.macro;
+      macro->used = 1;
       text = macro->exp.text;
       len = macro->count;
     }
@@ -802,7 +810,7 @@ recursive_macro (pfile, node)
      cpp_reader *pfile;
      cpp_hashnode *node;
 {
-  bool recursing = node->flags & NODE_DISABLED;
+  bool recursing = !!(node->flags & NODE_DISABLED);
 
   /* Object-like macros that are already expanding are necessarily
      recursive.