{
static char define_directive[] = "#define ";
int macro_name_length = strlen (macro_name);
- output_line_command (pfile, 0, same_file);
+ output_line_command (pfile, same_file);
CPP_RESERVE (pfile, sizeof(define_directive) + macro_name_length);
CPP_PUTS_Q (pfile, define_directive, sizeof(define_directive)-1);
CPP_PUTS_Q (pfile, macro_name, macro_name_length);
while (p)
{
if (opts->debug_output)
- output_line_command (pfile, 0, same_file);
+ output_line_command (pfile, same_file);
if (p->undef)
cpp_undef (pfile, p->arg);
else
while (p)
{
if (opts->debug_output)
- output_line_command (pfile, 0, same_file);
+ output_line_command (pfile, same_file);
if (p->undef)
cpp_unassert (pfile, p->arg);
else
ih_fake->limit = 0;
if (!finclude (pfile, f, ih_fake))
return 0;
- output_line_command (pfile, 0, same_file);
+ output_line_command (pfile, same_file);
pfile->only_seen_white = 2;
/* The -imacros files can be scanned now, but the -include files
ih_fake->buf = (char *)-1;
ih_fake->limit = 0;
if (finclude (pfile, fd, ih_fake))
- output_line_command (pfile, 0, enter_file);
+ output_line_command (pfile, enter_file);
q = p->next;
free (p);
}
}
}
+
+ if (opts->dump_macros == dump_only)
+ {
+ int i;
+ HASHNODE *h;
+ MACRODEF m;
+ for (i = HASHSIZE; --i >= 0;)
+ {
+ for (h = pfile->hashtab[i]; h; h = h->next)
+ if (h->type == T_MACRO)
+ {
+ m.defn = h->value.defn;
+ m.symnam = h->name;
+ m.symlen = h->length;
+ dump_definition (pfile, m);
+ CPP_PUTC (pfile, '\n');
+ }
+ }
+ }
}
/* Handle one command-line option in (argc, argv).
/*
* write out a #line command, for instance, after an #include file.
- * If CONDITIONAL is nonzero, we can omit the #line if it would
- * appear to be a no-op, and we can output a few newlines instead
- * if we want to increase the line number by a small amount.
* FILE_CHANGE says whether we are entering a file, leaving, or neither.
*/
void
-output_line_command (pfile, conditional, file_change)
+output_line_command (pfile, file_change)
cpp_reader *pfile;
- int conditional;
enum file_change_code file_change;
{
- long line, col;
+ long line;
cpp_buffer *ip = CPP_BUFFER (pfile);
if (ip->fname == NULL)
|| CPP_OPTIONS (pfile)->no_output)
return;
- cpp_buf_line_and_col (CPP_BUFFER (pfile), &line, &col);
+ cpp_buf_line_and_col (CPP_BUFFER (pfile), &line, NULL);
- if (conditional)
+ /* If the current file has not changed, we omit the #line if it would
+ appear to be a no-op, and we output a few newlines instead
+ if we want to increase the line number by a small amount.
+ We cannot do this if pfile->lineno is zero, because that means we
+ haven't output any line commands yet. (The very first line command
+ output is a `same_file' command.) */
+ if (file_change == same_file && pfile->lineno != 0)
{
if (line == pfile->lineno)
return;
if (finclude (pfile, fd, ihash))
{
- output_line_command (pfile, 0, enter_file);
+ output_line_command (pfile, enter_file);
pfile->only_seen_white = 2;
}
we must store a line number now that is one less. */
ip->lineno = new_lineno - 1;
CPP_SET_WRITTEN (pfile, old_written);
- output_line_command (pfile, 0, file_change);
+ output_line_command (pfile, file_change);
return 0;
bad_line_directive:
skip_if_group (pfile);
else {
++pfile->if_stack->if_succeeded; /* continue processing input */
- output_line_command (pfile, 1, same_file);
+ output_line_command (pfile, same_file);
}
}
return 0;
return;
} else {
++pfile->if_stack->if_succeeded;
- output_line_command (pfile, 1, same_file);
+ output_line_command (pfile, same_file);
}
}
{
CPP_PUTS (pfile, "#failed\n", 8);
pfile->lineno++;
- output_line_command (pfile, 1, same_file);
+ output_line_command (pfile, same_file);
}
old_written = CPP_WRITTEN (pfile);
skip_if_group (pfile);
else {
++pfile->if_stack->if_succeeded; /* continue processing input */
- output_line_command (pfile, 1, same_file);
+ output_line_command (pfile, same_file);
}
return 0;
}
}
}
free (temp);
- output_line_command (pfile, 1, same_file);
+ output_line_command (pfile, same_file);
}
return 0;
}
cpp_buffer *cur_buffer = CPP_BUFFER (pfile);
CPP_BUFFER (pfile) = next_buf;
pfile->input_stack_listing_current = 0;
- output_line_command (pfile, 0, leave_file);
+ output_line_command (pfile, leave_file);
CPP_BUFFER (pfile) = cur_buffer;
}
return CPP_POP;
/* OK, now bring us back to the state we were in before we entered
this branch. We need #line because the newline for the pragma
could mess things up. */
- output_line_command (pfile, 0, same_file);
+ output_line_command (pfile, same_file);
*(obp++) = ' '; /* just in case, if comments are copied thru */
*(obp++) = '/';
}
if (pfile->only_seen_white == 0)
pfile->only_seen_white = 1;
CPP_BUMP_LINE (pfile);
- pfile->lineno++;
- if (CPP_BUFFER (pfile)->lineno != pfile->lineno)
- output_line_command (pfile, 1, same_file);
+ if (! CPP_OPTIONS (pfile)->no_line_commands)
+ {
+ pfile->lineno++;
+ if (CPP_BUFFER (pfile)->lineno != pfile->lineno)
+ output_line_command (pfile, same_file);
+ }
return CPP_VSPACE;
case '(': token = CPP_LPAREN; goto char1;