const uchar *
_cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
{
+ const struct line_map *map;
const uchar *result = NULL;
unsigned int number = 1;
unsigned int len;
const char *name;
uchar *buf;
- const struct line_map *map = pfile->map;
+ map = linemap_lookup (pfile->line_table, pfile->line_table->highest_line);
if (node->value.builtin == BT_BASE_FILE)
while (! MAIN_FILE_P (map))
break;
case BT_SPECLINE:
+ map = &pfile->line_table->maps[pfile->line_table->used-1];
/* If __LINE__ is embedded in a macro, it must expand to the
line of the macro's invocation, not its definition.
Otherwise things like assert() will not work properly. */
if (CPP_OPTION (pfile, traditional))
- number = pfile->line;
+ number = pfile->line_table->highest_line;
else
- number = pfile->cur_token[-1].line;
- number = SOURCE_LINE (pfile->map, number);
+ number = pfile->cur_token[-1].src_loc;
+ number = SOURCE_LINE (map, number);
break;
/* __STDC__ has the value 1 under normal circumstances.
value 0. */
case BT_STDC:
{
- if (CPP_IN_SYSTEM_HEADER (pfile)
+ if (cpp_in_system_header (pfile)
&& CPP_OPTION (pfile, stdc_0_in_system_headers)
&& !CPP_OPTION (pfile,std))
number = 0;
void
cpp_scan_nooutput (cpp_reader *pfile)
{
+ /* Request a CPP_EOF token at the end of this file, rather than
+ transparently continuing with the including file. */
+ pfile->buffer->return_at_eof = true;
+
if (CPP_OPTION (pfile, traditional))
while (_cpp_read_logical_line_trad (pfile))
;
_cpp_save_parameter (pfile, macro,
pfile->spec_nodes.n__VA_ARGS__);
pfile->state.va_args_ok = 1;
- if (! CPP_OPTION (pfile, c99) && CPP_OPTION (pfile, pedantic))
+ if (! CPP_OPTION (pfile, c99)
+ && CPP_OPTION (pfile, pedantic)
+ && CPP_OPTION (pfile, warn_variadic_macros))
cpp_error (pfile, CPP_DL_PEDWARN,
"anonymous variadic macros were introduced in C99");
}
- else if (CPP_OPTION (pfile, pedantic))
+ else if (CPP_OPTION (pfile, pedantic)
+ && CPP_OPTION (pfile, warn_variadic_macros))
cpp_error (pfile, CPP_DL_PEDWARN,
"ISO C does not permit named variadic macros");
macro->count = 0;
macro->fun_like = 0;
/* To suppress some diagnostics. */
- macro->syshdr = pfile->map->sysp != 0;
+ macro->syshdr = pfile->buffer && pfile->buffer->sysp != 0;
if (CPP_OPTION (pfile, traditional))
ok = _cpp_create_trad_definition (pfile, macro);