cpperror.c (print_location): Don't take a file name; use the line map instead.
* cpperror.c (print_location): Don't take a file name; use the line map instead. (_cpp_begin_message): Similarly. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update. (cpp_pedwarn_with_file_and_line): Remove. * cppfiles.c (stack_include_file): Update; set filename to stdin here when appropriate. * cpphash.h (struct cpp_buffer): Remove nominal_fname. (_cpp_begin_message): Don't take a file name. * cppinit.c: Add comment. * cpplex.c: Fix end-of-directive indicator. * cpplib.c: Don't include intl.h. (run_directive, do_diagnostic): Update. (do_line): Update to not use nominal_fname. (cpp_push_buffer): Don't take a filename. * cpplib.h (struct ht): Remove. (cpp_push_buffer): Don't take a filename. (cpp_pedwarn_with_file_and_line): Remove. * cppmacro.c (struct cpp_macro): Remove file. (builtin_macro): Update. (_cpp_create_definition): Update. * cppmain.c: Correct comment. * fix-header.c (read_scan_file): Update. From-SVN: r44986
This commit is contained in:
parent
c009f01f06
commit
bb74c96301
|
@ -1,3 +1,30 @@
|
|||
2001-08-17 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cpperror.c (print_location): Don't take a file name; use the
|
||||
line map instead.
|
||||
(_cpp_begin_message): Similarly.
|
||||
(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
|
||||
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update.
|
||||
(cpp_pedwarn_with_file_and_line): Remove.
|
||||
* cppfiles.c (stack_include_file): Update; set filename to stdin
|
||||
here when appropriate.
|
||||
* cpphash.h (struct cpp_buffer): Remove nominal_fname.
|
||||
(_cpp_begin_message): Don't take a file name.
|
||||
* cppinit.c: Add comment.
|
||||
* cpplex.c: Fix end-of-directive indicator.
|
||||
* cpplib.c: Don't include intl.h.
|
||||
(run_directive, do_diagnostic): Update.
|
||||
(do_line): Update to not use nominal_fname.
|
||||
(cpp_push_buffer): Don't take a filename.
|
||||
* cpplib.h (struct ht): Remove.
|
||||
(cpp_push_buffer): Don't take a filename.
|
||||
(cpp_pedwarn_with_file_and_line): Remove.
|
||||
* cppmacro.c (struct cpp_macro): Remove file.
|
||||
(builtin_macro): Update.
|
||||
(_cpp_create_definition): Update.
|
||||
* cppmain.c: Correct comment.
|
||||
* fix-header.c (read_scan_file): Update.
|
||||
|
||||
2001-08-17 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
* sbitmap.c: Fix comment formatting.
|
||||
|
|
107
gcc/cpperror.c
107
gcc/cpperror.c
|
@ -30,7 +30,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "intl.h"
|
||||
|
||||
static void print_location PARAMS ((cpp_reader *,
|
||||
const char *,
|
||||
const cpp_lexer_pos *));
|
||||
|
||||
/* Don't remove the blank before do, as otherwise the exgettext
|
||||
|
@ -39,9 +38,8 @@ static void print_location PARAMS ((cpp_reader *,
|
|||
do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
|
||||
|
||||
static void
|
||||
print_location (pfile, filename, pos)
|
||||
print_location (pfile, pos)
|
||||
cpp_reader *pfile;
|
||||
const char *filename;
|
||||
const cpp_lexer_pos *pos;
|
||||
{
|
||||
cpp_buffer *buffer = pfile->buffer;
|
||||
|
@ -50,47 +48,28 @@ print_location (pfile, filename, pos)
|
|||
fprintf (stderr, "%s: ", progname);
|
||||
else
|
||||
{
|
||||
unsigned int line, col = 0;
|
||||
enum cpp_buffer_type type = buffer->type;
|
||||
unsigned int line, col;
|
||||
const struct line_map *map;
|
||||
|
||||
/* For _Pragma buffers, we want to print the location as
|
||||
"foo.c:5:8: _Pragma:", where foo.c is the containing buffer.
|
||||
For diagnostics relating to command line options, we want to
|
||||
print "<command line>:" with no line number. */
|
||||
if (type == BUF_CL_OPTION || type == BUF_BUILTIN)
|
||||
line = 0;
|
||||
else
|
||||
{
|
||||
const struct line_map *map;
|
||||
if (pos == 0)
|
||||
pos = cpp_get_line (pfile);
|
||||
map = lookup_line (&pfile->line_maps, pos->line);
|
||||
|
||||
if (type == BUF_PRAGMA)
|
||||
buffer = buffer->prev;
|
||||
print_containing_files (&pfile->line_maps, map);
|
||||
|
||||
if (pos == 0)
|
||||
pos = cpp_get_line (pfile);
|
||||
map = lookup_line (&pfile->line_maps, pos->line);
|
||||
line = SOURCE_LINE (map, pos->line);
|
||||
if (filename == 0)
|
||||
filename = map->to_file;
|
||||
|
||||
col = pos->col;
|
||||
if (col == 0)
|
||||
col = 1;
|
||||
|
||||
print_containing_files (&pfile->line_maps, map);
|
||||
}
|
||||
|
||||
if (filename == 0)
|
||||
filename = buffer->nominal_fname;
|
||||
line = SOURCE_LINE (map, pos->line);
|
||||
col = pos->col;
|
||||
if (col == 0)
|
||||
col = 1;
|
||||
|
||||
if (line == 0)
|
||||
fprintf (stderr, "%s:", filename);
|
||||
fprintf (stderr, "%s:", map->to_file);
|
||||
else if (CPP_OPTION (pfile, show_column) == 0)
|
||||
fprintf (stderr, "%s:%u:", filename, line);
|
||||
fprintf (stderr, "%s:%u:", map->to_file, line);
|
||||
else
|
||||
fprintf (stderr, "%s:%u:%u:", filename, line, col);
|
||||
fprintf (stderr, "%s:%u:%u:", map->to_file, line, col);
|
||||
|
||||
if (type == BUF_PRAGMA)
|
||||
if (buffer->type == BUF_PRAGMA)
|
||||
fprintf (stderr, "_Pragma:");
|
||||
fputc (' ', stderr);
|
||||
}
|
||||
|
@ -101,10 +80,9 @@ print_location (pfile, filename, pos)
|
|||
If it returns 0, this error has been suppressed. */
|
||||
|
||||
int
|
||||
_cpp_begin_message (pfile, code, file, pos)
|
||||
_cpp_begin_message (pfile, code, pos)
|
||||
cpp_reader *pfile;
|
||||
enum error_type code;
|
||||
const char *file;
|
||||
const cpp_lexer_pos *pos;
|
||||
{
|
||||
int is_warning = 0;
|
||||
|
@ -149,7 +127,7 @@ _cpp_begin_message (pfile, code, file, pos)
|
|||
break;
|
||||
}
|
||||
|
||||
print_location (pfile, file, pos);
|
||||
print_location (pfile, pos);
|
||||
if (is_warning)
|
||||
fputs (_("warning: "), stderr);
|
||||
|
||||
|
@ -177,7 +155,7 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
|||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
if (_cpp_begin_message (pfile, ICE, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, ICE, 0))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -204,7 +182,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
|||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
if (_cpp_begin_message (pfile, FATAL, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, FATAL, 0))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -225,7 +203,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
|||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
if (_cpp_begin_message (pfile, ERROR, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, ERROR, 0))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -254,7 +232,7 @@ cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
|
|||
|
||||
pos.line = line;
|
||||
pos.col = column;
|
||||
if (_cpp_begin_message (pfile, ERROR, NULL, &pos))
|
||||
if (_cpp_begin_message (pfile, ERROR, &pos))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -284,7 +262,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
|||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
if (_cpp_begin_message (pfile, WARNING, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, WARNING, 0))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -313,7 +291,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
|||
|
||||
pos.line = line;
|
||||
pos.col = column;
|
||||
if (_cpp_begin_message (pfile, WARNING, NULL, &pos))
|
||||
if (_cpp_begin_message (pfile, WARNING, &pos))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -334,7 +312,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
|||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
if (_cpp_begin_message (pfile, PEDWARN, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, PEDWARN, 0))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -363,42 +341,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
|||
|
||||
pos.line = line;
|
||||
pos.col = column;
|
||||
if (_cpp_begin_message (pfile, PEDWARN, NULL, &pos))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* Report a warning (or an error if pedantic_errors)
|
||||
giving specified file name and line number, not current. */
|
||||
|
||||
void
|
||||
cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile,
|
||||
const char *file, int line, int col,
|
||||
const char *msgid, ...))
|
||||
{
|
||||
#ifndef ANSI_PROTOTYPES
|
||||
cpp_reader *pfile;
|
||||
const char *file;
|
||||
int line;
|
||||
int col;
|
||||
const char *msgid;
|
||||
#endif
|
||||
va_list ap;
|
||||
cpp_lexer_pos pos;
|
||||
|
||||
VA_START (ap, msgid);
|
||||
|
||||
#ifndef ANSI_PROTOTYPES
|
||||
pfile = va_arg (ap, cpp_reader *);
|
||||
file = va_arg (ap, const char *);
|
||||
line = va_arg (ap, int);
|
||||
col = va_arg (ap, int);
|
||||
msgid = va_arg (ap, const char *);
|
||||
#endif
|
||||
|
||||
pos.line = line;
|
||||
pos.col = col;
|
||||
if (_cpp_begin_message (pfile, PEDWARN, file, &pos))
|
||||
if (_cpp_begin_message (pfile, PEDWARN, &pos))
|
||||
v_message (msgid, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ stack_include_file (pfile, inc)
|
|||
size_t len = 0;
|
||||
cpp_buffer *fp;
|
||||
int sysp, deps_sysp;
|
||||
const char *filename;
|
||||
|
||||
/* We'll try removing deps_sysp after the release of 3.0. */
|
||||
deps_sysp = pfile->system_include_depth != 0;
|
||||
|
@ -326,7 +327,7 @@ stack_include_file (pfile, inc)
|
|||
}
|
||||
|
||||
/* Push a buffer. */
|
||||
fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, inc->name, 0);
|
||||
fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, 0);
|
||||
fp->inc = inc;
|
||||
fp->inc->refcnt++;
|
||||
|
||||
|
@ -336,7 +337,10 @@ stack_include_file (pfile, inc)
|
|||
pfile->include_depth++;
|
||||
|
||||
/* Generate the call back. */
|
||||
_cpp_do_file_change (pfile, LC_ENTER, fp->nominal_fname, 1, sysp);
|
||||
filename = inc->name;
|
||||
if (*filename == '\0')
|
||||
filename = _("<stdin>");
|
||||
_cpp_do_file_change (pfile, LC_ENTER, filename, 1, sysp);
|
||||
}
|
||||
|
||||
/* Read the file referenced by INC into the file cache.
|
||||
|
|
|
@ -176,9 +176,6 @@ struct cpp_buffer
|
|||
|
||||
const unsigned char *buf; /* entire buffer */
|
||||
|
||||
/* Filename specified with #line command. */
|
||||
const char *nominal_fname;
|
||||
|
||||
/* Pointer into the include table. Used for include_next and
|
||||
to record control macros. */
|
||||
struct include_file *inc;
|
||||
|
@ -375,7 +372,7 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
|
|||
/* In cpperror.c */
|
||||
enum error_type { WARNING = 0, WARNING_SYSHDR, PEDWARN, ERROR, FATAL, ICE };
|
||||
extern int _cpp_begin_message PARAMS ((cpp_reader *, enum error_type,
|
||||
const char *, const cpp_lexer_pos *));
|
||||
const cpp_lexer_pos *));
|
||||
|
||||
/* In cppmacro.c */
|
||||
extern void _cpp_free_definition PARAMS ((cpp_hashnode *));
|
||||
|
|
|
@ -861,7 +861,7 @@ init_standard_includes (pfile)
|
|||
|| (CPP_OPTION (pfile, cplusplus)
|
||||
&& !CPP_OPTION (pfile, no_standard_cplusplus_includes)))
|
||||
{
|
||||
char *str = xstrdup (update_path (p->fname, p->component));
|
||||
char *str = update_path (p->fname, p->component);
|
||||
append_include_chain (pfile, str, SYSTEM, p->cxx_aware);
|
||||
}
|
||||
}
|
||||
|
@ -939,6 +939,9 @@ cpp_start_read (pfile, fname)
|
|||
if (!_cpp_read_file (pfile, fname))
|
||||
return 0;
|
||||
|
||||
/* FIXME: we want to set up linemaps with _("<builtin>") and
|
||||
_("<command line>") somewhere round here. Harder than it looks. */
|
||||
|
||||
/* If already preprocessed, don't install __LINE__, etc., and ignore
|
||||
command line definitions and assertions. Handle -U's, -D's and
|
||||
-A's in the order they were seen. */
|
||||
|
|
|
@ -894,7 +894,7 @@ _cpp_lex_token (pfile, result)
|
|||
in-progress directives and arguments have been taken care of.
|
||||
Decrement the line to terminate an in-progress directive. */
|
||||
if (pfile->state.in_directive)
|
||||
pfile->line--;
|
||||
pfile->lexer_pos.output_line = pfile->line--;
|
||||
else if (! pfile->state.parsing_args)
|
||||
{
|
||||
/* Non-empty files should end in a newline. Don't warn for
|
||||
|
|
40
gcc/cpplib.c
40
gcc/cpplib.c
|
@ -24,7 +24,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
|
||||
#include "cpplib.h"
|
||||
#include "cpphash.h"
|
||||
#include "intl.h"
|
||||
#include "obstack.h"
|
||||
|
||||
/* Chained list of answers to an assertion. */
|
||||
|
@ -403,7 +402,7 @@ run_directive (pfile, dir_no, type, buf, count)
|
|||
{
|
||||
cpp_buffer *buffer;
|
||||
|
||||
buffer = cpp_push_buffer (pfile, (const U_CHAR *) buf, count, type, 0, 1);
|
||||
buffer = cpp_push_buffer (pfile, (const U_CHAR *) buf, count, type, 1);
|
||||
start_directive (pfile);
|
||||
pfile->state.prevent_expansion++;
|
||||
pfile->directive = &dtable[dir_no];
|
||||
|
@ -710,11 +709,11 @@ static void
|
|||
do_line (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
cpp_buffer *buffer = pfile->buffer;
|
||||
enum lc_reason reason = LC_RENAME;
|
||||
unsigned long new_lineno;
|
||||
unsigned int cap, sysp = pfile->map->sysp;
|
||||
cpp_token token;
|
||||
const char *new_file = pfile->map->to_file;
|
||||
unsigned long new_lineno;
|
||||
unsigned int cap, new_sysp = pfile->map->sysp;
|
||||
enum lc_reason reason = LC_RENAME;
|
||||
|
||||
/* C99 raised the minimum limit on #line numbers. */
|
||||
cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
|
||||
|
@ -736,20 +735,20 @@ do_line (pfile)
|
|||
cpp_get_token (pfile, &token);
|
||||
if (token.type == CPP_STRING)
|
||||
{
|
||||
buffer->nominal_fname = (const char *) token.val.str.text;
|
||||
new_file = (const char *) token.val.str.text;
|
||||
|
||||
/* Only accept flags for the # 55 form. */
|
||||
if (pfile->state.line_extension)
|
||||
{
|
||||
int flag;
|
||||
|
||||
sysp = 0;
|
||||
new_sysp = 0;
|
||||
flag = read_flag (pfile, 0);
|
||||
if (flag == 1)
|
||||
{
|
||||
reason = LC_ENTER;
|
||||
/* Fake an include for cpp_included (). */
|
||||
_cpp_fake_include (pfile, buffer->nominal_fname);
|
||||
_cpp_fake_include (pfile, new_file);
|
||||
flag = read_flag (pfile, flag);
|
||||
}
|
||||
else if (flag == 2)
|
||||
|
@ -759,10 +758,10 @@ do_line (pfile)
|
|||
}
|
||||
if (flag == 3)
|
||||
{
|
||||
sysp = 1;
|
||||
new_sysp = 1;
|
||||
flag = read_flag (pfile, flag);
|
||||
if (flag == 4)
|
||||
sysp = 2;
|
||||
new_sysp = 2;
|
||||
}
|
||||
}
|
||||
check_eol (pfile);
|
||||
|
@ -775,8 +774,7 @@ do_line (pfile)
|
|||
}
|
||||
|
||||
end_directive (pfile, 1);
|
||||
_cpp_do_file_change (pfile, reason, (const char *) buffer->nominal_fname,
|
||||
new_lineno, sysp);
|
||||
_cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
|
||||
}
|
||||
|
||||
/* Arrange the file_change callback. pfile->line has changed to
|
||||
|
@ -809,7 +807,7 @@ do_diagnostic (pfile, code, print_dir)
|
|||
enum error_type code;
|
||||
int print_dir;
|
||||
{
|
||||
if (_cpp_begin_message (pfile, code, NULL, 0))
|
||||
if (_cpp_begin_message (pfile, code, 0))
|
||||
{
|
||||
if (print_dir)
|
||||
fprintf (stderr, "#%s ", pfile->directive->name);
|
||||
|
@ -1737,23 +1735,15 @@ cpp_set_callbacks (pfile, cb)
|
|||
doesn't fail. It does not generate a file change call back; that
|
||||
is the responsibility of the caller. */
|
||||
cpp_buffer *
|
||||
cpp_push_buffer (pfile, buffer, len, type, filename, return_at_eof)
|
||||
cpp_push_buffer (pfile, buffer, len, type, return_at_eof)
|
||||
cpp_reader *pfile;
|
||||
const U_CHAR *buffer;
|
||||
size_t len;
|
||||
enum cpp_buffer_type type;
|
||||
const char *filename;
|
||||
int return_at_eof;
|
||||
{
|
||||
cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer);
|
||||
|
||||
if (type == BUF_BUILTIN)
|
||||
filename = _("<builtin>");
|
||||
else if (type == BUF_CL_OPTION)
|
||||
filename = _("<command line>");
|
||||
else if (type == BUF_PRAGMA)
|
||||
filename = "<_Pragma>";
|
||||
|
||||
/* Clears, amongst other things, if_stack and mi_cmacro. */
|
||||
memset (new, 0, sizeof (cpp_buffer));
|
||||
|
||||
|
@ -1768,10 +1758,6 @@ cpp_push_buffer (pfile, buffer, len, type, filename, return_at_eof)
|
|||
options don't do trigraph and escaped newline processing. */
|
||||
new->from_stage3 = type != BUF_FILE || CPP_OPTION (pfile, preprocessed);
|
||||
|
||||
if (*filename == '\0')
|
||||
new->nominal_fname = _("<stdin>");
|
||||
else
|
||||
new->nominal_fname = filename;
|
||||
new->type = type;
|
||||
new->prev = pfile->buffer;
|
||||
new->pfile = pfile;
|
||||
|
|
|
@ -47,7 +47,6 @@ typedef struct cpp_callbacks cpp_callbacks;
|
|||
|
||||
struct answer;
|
||||
struct file_name_map_list;
|
||||
struct ht;
|
||||
|
||||
/* The first two groups, apart from '=', can appear in preprocessor
|
||||
expressions. This allows a lookup table to be implemented in
|
||||
|
@ -542,8 +541,7 @@ extern void cpp_unassert PARAMS ((cpp_reader *, const char *));
|
|||
|
||||
extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
|
||||
const unsigned char *, size_t,
|
||||
enum cpp_buffer_type,
|
||||
const char *, int));
|
||||
enum cpp_buffer_type, int));
|
||||
extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int));
|
||||
|
||||
/* N.B. The error-message-printer prototypes have not been nicely
|
||||
|
@ -570,8 +568,6 @@ extern void cpp_warning_with_line PARAMS ((cpp_reader *, int, int, const char *m
|
|||
ATTRIBUTE_PRINTF_4;
|
||||
extern void cpp_pedwarn_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
|
||||
ATTRIBUTE_PRINTF_4;
|
||||
extern void cpp_pedwarn_with_file_and_line PARAMS ((cpp_reader *, const char *, int, int, const char *msgid, ...))
|
||||
ATTRIBUTE_PRINTF_5;
|
||||
extern void cpp_error_from_errno PARAMS ((cpp_reader *, const char *));
|
||||
extern void cpp_notice_from_errno PARAMS ((cpp_reader *, const char *));
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ struct cpp_macro
|
|||
{
|
||||
cpp_hashnode **params; /* Parameters, if any. */
|
||||
cpp_token *expansion; /* First token of replacement list. */
|
||||
const char *file; /* Defined in file name. */
|
||||
unsigned int line; /* Starting line number. */
|
||||
unsigned int count; /* Number of tokens in expansion. */
|
||||
unsigned short paramc; /* Number of parameters. */
|
||||
|
@ -152,13 +151,13 @@ builtin_macro (pfile, token)
|
|||
case BT_BASE_FILE:
|
||||
{
|
||||
const char *name;
|
||||
cpp_buffer *buffer = pfile->buffer;
|
||||
const struct line_map *map = pfile->map;
|
||||
|
||||
if (node->value.builtin == BT_BASE_FILE)
|
||||
while (buffer->prev)
|
||||
buffer = buffer->prev;
|
||||
while (! MAIN_FILE_P (map))
|
||||
map = INCLUDED_FROM (&pfile->line_maps, map);
|
||||
|
||||
name = buffer->nominal_fname;
|
||||
name = map->to_file;
|
||||
make_string_token (&pfile->ident_pool, token,
|
||||
(const unsigned char *) name, strlen (name));
|
||||
}
|
||||
|
@ -1372,7 +1371,6 @@ _cpp_create_definition (pfile, node)
|
|||
|
||||
macro = (cpp_macro *) _cpp_pool_alloc (&pfile->macro_pool,
|
||||
sizeof (cpp_macro));
|
||||
macro->file = pfile->buffer->nominal_fname;
|
||||
macro->line = pfile->directive_pos.line;
|
||||
macro->params = 0;
|
||||
macro->paramc = 0;
|
||||
|
@ -1476,9 +1474,7 @@ _cpp_create_definition (pfile, node)
|
|||
"\"%s\" redefined", NODE_NAME (node));
|
||||
|
||||
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
|
||||
cpp_pedwarn_with_file_and_line (pfile,
|
||||
node->value.macro->file,
|
||||
node->value.macro->line, 1,
|
||||
cpp_pedwarn_with_line (pfile, node->value.macro->line, 1,
|
||||
"this is the location of the previous definition");
|
||||
}
|
||||
_cpp_free_definition (node);
|
||||
|
|
|
@ -419,8 +419,7 @@ cb_file_change (pfile, map)
|
|||
print.map = map;
|
||||
}
|
||||
|
||||
/* Copy a #pragma directive to the preprocessed output. LINE is the
|
||||
line of the current source file, not the logical line. */
|
||||
/* Copy a #pragma directive to the preprocessed output. */
|
||||
static void
|
||||
cb_def_pragma (pfile, line)
|
||||
cpp_reader *pfile;
|
||||
|
|
|
@ -658,7 +658,7 @@ read_scan_file (in_fname, argc, argv)
|
|||
|
||||
/* Scan the macro expansion of "getchar();". */
|
||||
cpp_push_buffer (scan_in, getchar_call, sizeof(getchar_call) - 1,
|
||||
BUF_BUILTIN, in_fname, 1);
|
||||
BUF_BUILTIN, 1);
|
||||
for (;;)
|
||||
{
|
||||
cpp_token t;
|
||||
|
|
Loading…
Reference in New Issue