c-ppoutput.c (cb_include): Don't take a cpp_token.
* c-ppoutput.c (cb_include): Don't take a cpp_token. * cppfiles.c: Don't undef strcmp. (find_include_file): Don't take a cpp_token. Check for empty file names. (_cpp_execute_include, _cpp_compare_file_date): Don't take a cpp_token. (cpp_push_include): Simplify. * cpphash.h (_cpp_execute_include, _cpp_compare_file_date): Update. * cpplib.c (glue_header_name): Return the file name, not a cpp_token. (parse_include): Similary. Don't check for zero-length filenames. (do_include_common, do_pragma_dependency): Update accordingly. * cpplib.h (struct cpp_callbacks): Change prototype of include. From-SVN: r65894
This commit is contained in:
parent
65085aa3ef
commit
74eb4b3e2e
|
@ -1,3 +1,17 @@
|
||||||
|
2003-04-21 Neil Booth <neil@daikokuya.co.uk>
|
||||||
|
|
||||||
|
* c-ppoutput.c (cb_include): Don't take a cpp_token.
|
||||||
|
* cppfiles.c: Don't undef strcmp.
|
||||||
|
(find_include_file): Don't take a cpp_token. Check for empty
|
||||||
|
file names.
|
||||||
|
(_cpp_execute_include, _cpp_compare_file_date): Don't take a cpp_token.
|
||||||
|
(cpp_push_include): Simplify.
|
||||||
|
* cpphash.h (_cpp_execute_include, _cpp_compare_file_date): Update.
|
||||||
|
* cpplib.c (glue_header_name): Return the file name, not a cpp_token.
|
||||||
|
(parse_include): Similary. Don't check for zero-length filenames.
|
||||||
|
(do_include_common, do_pragma_dependency): Update accordingly.
|
||||||
|
* cpplib.h (struct cpp_callbacks): Change prototype of include.
|
||||||
|
|
||||||
2003-04-21 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
2003-04-21 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||||
|
|
||||||
* expr.c (store_constructor): Set RTX_UNCHANGING_P if readonly_field_p
|
* expr.c (store_constructor): Set RTX_UNCHANGING_P if readonly_field_p
|
||||||
|
|
|
@ -55,7 +55,7 @@ static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int));
|
||||||
static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||||
static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||||
static void cb_include PARAMS ((cpp_reader *, unsigned int,
|
static void cb_include PARAMS ((cpp_reader *, unsigned int,
|
||||||
const unsigned char *, const cpp_token *));
|
const unsigned char *, const char *, int));
|
||||||
static void cb_ident PARAMS ((cpp_reader *, unsigned int,
|
static void cb_ident PARAMS ((cpp_reader *, unsigned int,
|
||||||
const cpp_string *));
|
const cpp_string *));
|
||||||
static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
|
static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
|
||||||
|
@ -345,15 +345,18 @@ cb_undef (pfile, line, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cb_include (pfile, line, dir, header)
|
cb_include (pfile, line, dir, header, angle_brackets)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile ATTRIBUTE_UNUSED;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
const unsigned char *dir;
|
const unsigned char *dir;
|
||||||
const cpp_token *header;
|
const char *header;
|
||||||
|
int angle_brackets;
|
||||||
{
|
{
|
||||||
maybe_print_line (print.map, line);
|
maybe_print_line (print.map, line);
|
||||||
fprintf (print.outf, "#%s %s\n", dir,
|
if (angle_brackets)
|
||||||
cpp_token_as_text (pfile, header));
|
fprintf (print.outf, "#%s <%s>\n", dir, header);
|
||||||
|
else
|
||||||
|
fprintf (print.outf, "#%s \"%s\"\n", dir, header);
|
||||||
print.line++;
|
print.line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
# define ENOTDIR 0
|
# define ENOTDIR 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress warning about function macros used w/o arguments in traditional
|
|
||||||
C. It is unlikely that glibc's strcmp macro helps this file at all. */
|
|
||||||
#undef strcmp
|
|
||||||
|
|
||||||
/* This structure is used for the table of all includes. */
|
/* This structure is used for the table of all includes. */
|
||||||
struct include_file {
|
struct include_file {
|
||||||
const char *name; /* actual path name of file */
|
const char *name; /* actual path name of file */
|
||||||
|
@ -98,7 +94,7 @@ static char *remap_filename PARAMS ((cpp_reader *, char *,
|
||||||
static struct cpp_path *search_from PARAMS ((cpp_reader *,
|
static struct cpp_path *search_from PARAMS ((cpp_reader *,
|
||||||
enum include_type));
|
enum include_type));
|
||||||
static struct include_file *
|
static struct include_file *
|
||||||
find_include_file PARAMS ((cpp_reader *, const cpp_token *,
|
find_include_file PARAMS ((cpp_reader *, const char *, int,
|
||||||
enum include_type));
|
enum include_type));
|
||||||
static struct include_file *open_file PARAMS ((cpp_reader *, const char *));
|
static struct include_file *open_file PARAMS ((cpp_reader *, const char *));
|
||||||
static struct include_file *validate_pch PARAMS ((cpp_reader *,
|
static struct include_file *validate_pch PARAMS ((cpp_reader *,
|
||||||
|
@ -597,22 +593,28 @@ cpp_included (pfile, fname)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for HEADER. Return 0 if there is no such file (or it's
|
/* Search for FNAME. Return 0 if there is no such file (or it's
|
||||||
un-openable), in which case an error code will be in errno. If
|
un-openable), in which case an error code will be in errno. If
|
||||||
there is no include path to use it returns NO_INCLUDE_PATH,
|
there is no include path to use it returns NO_INCLUDE_PATH,
|
||||||
otherwise an include_file structure. If this request originates
|
otherwise an include_file structure. If this request originates
|
||||||
from a directive of TYPE #include_next, set INCLUDE_NEXT to true. */
|
from a directive of TYPE #include_next, set INCLUDE_NEXT to true. */
|
||||||
static struct include_file *
|
static struct include_file *
|
||||||
find_include_file (pfile, header, type)
|
find_include_file (pfile, fname, angle_brackets, type)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
const cpp_token *header;
|
const char *fname;
|
||||||
|
int angle_brackets;
|
||||||
enum include_type type;
|
enum include_type type;
|
||||||
{
|
{
|
||||||
const char *fname = (const char *) header->val.str.text;
|
|
||||||
struct cpp_path *path;
|
struct cpp_path *path;
|
||||||
struct include_file *file;
|
struct include_file *file;
|
||||||
char *name, *n;
|
char *name, *n;
|
||||||
|
|
||||||
|
if (*fname == '\0')
|
||||||
|
{
|
||||||
|
cpp_error (pfile, DL_ERROR, "empty file name");
|
||||||
|
return NO_INCLUDE_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_ABSOLUTE_PATHNAME (fname))
|
if (IS_ABSOLUTE_PATHNAME (fname))
|
||||||
return open_file_pch (pfile, fname);
|
return open_file_pch (pfile, fname);
|
||||||
|
|
||||||
|
@ -621,7 +623,7 @@ find_include_file (pfile, header, type)
|
||||||
path use the normal search logic. */
|
path use the normal search logic. */
|
||||||
if (type == IT_INCLUDE_NEXT && pfile->buffer->inc->foundhere)
|
if (type == IT_INCLUDE_NEXT && pfile->buffer->inc->foundhere)
|
||||||
path = pfile->buffer->inc->foundhere->next;
|
path = pfile->buffer->inc->foundhere->next;
|
||||||
else if (header->type == CPP_HEADER_NAME)
|
else if (angle_brackets)
|
||||||
path = pfile->bracket_include;
|
path = pfile->bracket_include;
|
||||||
else
|
else
|
||||||
path = search_from (pfile, type);
|
path = search_from (pfile, type);
|
||||||
|
@ -751,17 +753,18 @@ handle_missing_header (pfile, fname, angle_brackets)
|
||||||
including HEADER, and the command line -imacros and -include.
|
including HEADER, and the command line -imacros and -include.
|
||||||
Returns true if a buffer was stacked. */
|
Returns true if a buffer was stacked. */
|
||||||
bool
|
bool
|
||||||
_cpp_execute_include (pfile, header, type)
|
_cpp_execute_include (pfile, fname, angle_brackets, type)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
const cpp_token *header;
|
const char *fname;
|
||||||
|
int angle_brackets;
|
||||||
enum include_type type;
|
enum include_type type;
|
||||||
{
|
{
|
||||||
bool stacked = false;
|
bool stacked = false;
|
||||||
struct include_file *inc = find_include_file (pfile, header, type);
|
struct include_file *inc;
|
||||||
|
|
||||||
|
inc = find_include_file (pfile, fname, angle_brackets, type);
|
||||||
if (inc == 0)
|
if (inc == 0)
|
||||||
handle_missing_header (pfile, (const char *) header->val.str.text,
|
handle_missing_header (pfile, fname, angle_brackets);
|
||||||
header->type == CPP_HEADER_NAME);
|
|
||||||
else if (inc != NO_INCLUDE_PATH)
|
else if (inc != NO_INCLUDE_PATH)
|
||||||
{
|
{
|
||||||
stacked = stack_include_file (pfile, inc);
|
stacked = stack_include_file (pfile, inc);
|
||||||
|
@ -777,12 +780,14 @@ _cpp_execute_include (pfile, header, type)
|
||||||
file. If it cannot be located or dated, return -1, if it is newer
|
file. If it cannot be located or dated, return -1, if it is newer
|
||||||
newer, return 1, otherwise 0. */
|
newer, return 1, otherwise 0. */
|
||||||
int
|
int
|
||||||
_cpp_compare_file_date (pfile, header)
|
_cpp_compare_file_date (pfile, fname, angle_brackets)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
const cpp_token *header;
|
const char *fname;
|
||||||
|
int angle_brackets;
|
||||||
{
|
{
|
||||||
struct include_file *inc = find_include_file (pfile, header, 0);
|
struct include_file *inc;
|
||||||
|
|
||||||
|
inc = find_include_file (pfile, fname, angle_brackets, IT_INCLUDE);
|
||||||
if (inc == NULL || inc == NO_INCLUDE_PATH)
|
if (inc == NULL || inc == NO_INCLUDE_PATH)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -825,15 +830,9 @@ cpp_push_include (pfile, filename)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
{
|
{
|
||||||
cpp_token header;
|
|
||||||
|
|
||||||
header.type = CPP_STRING;
|
|
||||||
header.val.str.text = (const unsigned char *) filename;
|
|
||||||
header.val.str.len = strlen (filename);
|
|
||||||
/* Make the command line directive take up a line. */
|
/* Make the command line directive take up a line. */
|
||||||
pfile->line++;
|
pfile->line++;
|
||||||
|
return _cpp_execute_include (pfile, filename, false, IT_CMDLINE);
|
||||||
return _cpp_execute_include (pfile, &header, IT_CMDLINE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do appropriate cleanup when a file INC's buffer is popped off the
|
/* Do appropriate cleanup when a file INC's buffer is popped off the
|
||||||
|
|
|
@ -498,11 +498,10 @@ extern void _cpp_destroy_hashtable PARAMS ((cpp_reader *));
|
||||||
extern void _cpp_fake_include PARAMS ((cpp_reader *, const char *));
|
extern void _cpp_fake_include PARAMS ((cpp_reader *, const char *));
|
||||||
extern void _cpp_never_reread PARAMS ((struct include_file *));
|
extern void _cpp_never_reread PARAMS ((struct include_file *));
|
||||||
extern bool _cpp_read_file PARAMS ((cpp_reader *, const char *));
|
extern bool _cpp_read_file PARAMS ((cpp_reader *, const char *));
|
||||||
extern bool _cpp_execute_include PARAMS ((cpp_reader *,
|
extern bool _cpp_execute_include PARAMS ((cpp_reader *, const char *,
|
||||||
const cpp_token *,
|
int, enum include_type));
|
||||||
enum include_type));
|
extern int _cpp_compare_file_date PARAMS ((cpp_reader *, const char *,
|
||||||
extern int _cpp_compare_file_date PARAMS ((cpp_reader *,
|
int));
|
||||||
const cpp_token *));
|
|
||||||
extern void _cpp_report_missing_guards PARAMS ((cpp_reader *));
|
extern void _cpp_report_missing_guards PARAMS ((cpp_reader *));
|
||||||
extern void _cpp_init_includes PARAMS ((cpp_reader *));
|
extern void _cpp_init_includes PARAMS ((cpp_reader *));
|
||||||
extern void _cpp_cleanup_includes PARAMS ((cpp_reader *));
|
extern void _cpp_cleanup_includes PARAMS ((cpp_reader *));
|
||||||
|
|
143
gcc/cpplib.c
143
gcc/cpplib.c
|
@ -104,8 +104,8 @@ static void directive_diagnostics
|
||||||
PARAMS ((cpp_reader *, const directive *, int));
|
PARAMS ((cpp_reader *, const directive *, int));
|
||||||
static void run_directive PARAMS ((cpp_reader *, int,
|
static void run_directive PARAMS ((cpp_reader *, int,
|
||||||
const char *, size_t));
|
const char *, size_t));
|
||||||
static const cpp_token *glue_header_name PARAMS ((cpp_reader *));
|
static char *glue_header_name PARAMS ((cpp_reader *));
|
||||||
static const cpp_token *parse_include PARAMS ((cpp_reader *));
|
static const char *parse_include PARAMS ((cpp_reader *, int *));
|
||||||
static void push_conditional PARAMS ((cpp_reader *, int, int,
|
static void push_conditional PARAMS ((cpp_reader *, int, int,
|
||||||
const cpp_hashnode *));
|
const cpp_hashnode *));
|
||||||
static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int));
|
static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int));
|
||||||
|
@ -570,96 +570,89 @@ do_undef (pfile)
|
||||||
|
|
||||||
/* Helper routine used by parse_include. Reinterpret the current line
|
/* Helper routine used by parse_include. Reinterpret the current line
|
||||||
as an h-char-sequence (< ... >); we are looking at the first token
|
as an h-char-sequence (< ... >); we are looking at the first token
|
||||||
after the <. Returns the header as a token, or NULL on failure. */
|
after the <. Returns a malloced filename. */
|
||||||
static const cpp_token *
|
static char *
|
||||||
glue_header_name (pfile)
|
glue_header_name (pfile)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
{
|
{
|
||||||
cpp_token *header = NULL;
|
|
||||||
const cpp_token *token;
|
const cpp_token *token;
|
||||||
unsigned char *buffer;
|
char *buffer;
|
||||||
size_t len, total_len = 0, capacity = 1024;
|
size_t len, total_len = 0, capacity = 1024;
|
||||||
|
|
||||||
/* To avoid lexed tokens overwriting our glued name, we can only
|
/* To avoid lexed tokens overwriting our glued name, we can only
|
||||||
allocate from the string pool once we've lexed everything. */
|
allocate from the string pool once we've lexed everything. */
|
||||||
buffer = (unsigned char *) xmalloc (capacity);
|
buffer = xmalloc (capacity);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
token = get_token_no_padding (pfile);
|
token = get_token_no_padding (pfile);
|
||||||
|
|
||||||
if (token->type == CPP_GREATER || token->type == CPP_EOF)
|
if (token->type == CPP_GREATER)
|
||||||
break;
|
break;
|
||||||
|
if (token->type == CPP_EOF)
|
||||||
|
{
|
||||||
|
cpp_error (pfile, DL_ERROR, "missing terminating > character");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
len = cpp_token_len (token);
|
len = cpp_token_len (token);
|
||||||
if (total_len + len > capacity)
|
if (total_len + len > capacity)
|
||||||
{
|
{
|
||||||
capacity = (capacity + len) * 2;
|
capacity = (capacity + len) * 2;
|
||||||
buffer = (unsigned char *) xrealloc (buffer, capacity);
|
buffer = xrealloc (buffer, capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token->flags & PREV_WHITE)
|
if (token->flags & PREV_WHITE)
|
||||||
buffer[total_len++] = ' ';
|
buffer[total_len++] = ' ';
|
||||||
|
|
||||||
total_len = cpp_spell_token (pfile, token, &buffer[total_len]) - buffer;
|
total_len = (cpp_spell_token (pfile, token, (uchar *) &buffer[total_len])
|
||||||
|
- (uchar *) buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token->type == CPP_EOF)
|
buffer[total_len] = '\0';
|
||||||
cpp_error (pfile, DL_ERROR, "missing terminating > character");
|
return buffer;
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned char *token_mem = _cpp_unaligned_alloc (pfile, total_len + 1);
|
|
||||||
memcpy (token_mem, buffer, total_len);
|
|
||||||
token_mem[total_len] = '\0';
|
|
||||||
|
|
||||||
header = _cpp_temp_token (pfile);
|
|
||||||
header->type = CPP_HEADER_NAME;
|
|
||||||
header->flags = 0;
|
|
||||||
header->val.str.len = total_len;
|
|
||||||
header->val.str.text = token_mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
free ((PTR) buffer);
|
|
||||||
return header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the header string of #include, #include_next, #import and
|
/* Returns the file name of #include, #include_next, #import and
|
||||||
#pragma dependency. Returns NULL on error. */
|
#pragma dependency. The string is malloced and the caller should
|
||||||
static const cpp_token *
|
free it. Returns NULL on error. */
|
||||||
parse_include (pfile)
|
static const char *
|
||||||
|
parse_include (pfile, pangle_brackets)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
|
int *pangle_brackets;
|
||||||
{
|
{
|
||||||
const unsigned char *dir;
|
char *fname;
|
||||||
const cpp_token *header;
|
const cpp_token *header;
|
||||||
|
|
||||||
if (pfile->directive == &dtable[T_PRAGMA])
|
|
||||||
dir = U"pragma dependency";
|
|
||||||
else
|
|
||||||
dir = pfile->directive->name;
|
|
||||||
|
|
||||||
/* Allow macro expansion. */
|
/* Allow macro expansion. */
|
||||||
header = get_token_no_padding (pfile);
|
header = get_token_no_padding (pfile);
|
||||||
if (header->type != CPP_STRING && header->type != CPP_HEADER_NAME)
|
if (header->type == CPP_STRING || header->type == CPP_HEADER_NAME)
|
||||||
{
|
{
|
||||||
if (header->type != CPP_LESS)
|
fname = xmalloc (header->val.str.len + 1);
|
||||||
{
|
memcpy (fname, header->val.str.text, header->val.str.len);
|
||||||
cpp_error (pfile, DL_ERROR,
|
fname[header->val.str.len] = '\0';
|
||||||
"#%s expects \"FILENAME\" or <FILENAME>", dir);
|
*pangle_brackets = header->type == CPP_HEADER_NAME;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
header = glue_header_name (pfile);
|
|
||||||
if (header == NULL)
|
|
||||||
return header;
|
|
||||||
}
|
}
|
||||||
|
else if (header->type == CPP_LESS)
|
||||||
if (header->val.str.len == 0)
|
|
||||||
{
|
{
|
||||||
cpp_error (pfile, DL_ERROR, "empty file name in #%s", dir);
|
fname = glue_header_name (pfile);
|
||||||
|
*pangle_brackets = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const unsigned char *dir;
|
||||||
|
|
||||||
|
if (pfile->directive == &dtable[T_PRAGMA])
|
||||||
|
dir = U"pragma dependency";
|
||||||
|
else
|
||||||
|
dir = pfile->directive->name;
|
||||||
|
cpp_error (pfile, DL_ERROR, "#%s expects \"FILENAME\" or <FILENAME>",
|
||||||
|
dir);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_eol (pfile);
|
check_eol (pfile);
|
||||||
return header;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle #include, #include_next and #import. */
|
/* Handle #include, #include_next and #import. */
|
||||||
|
@ -668,25 +661,29 @@ do_include_common (pfile, type)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
enum include_type type;
|
enum include_type type;
|
||||||
{
|
{
|
||||||
const cpp_token *header = parse_include (pfile);
|
const char *fname;
|
||||||
if (!header)
|
int angle_brackets;
|
||||||
|
|
||||||
|
fname = parse_include (pfile, &angle_brackets);
|
||||||
|
if (!fname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Prevent #include recursion. */
|
/* Prevent #include recursion. */
|
||||||
if (pfile->line_maps.depth >= CPP_STACK_MAX)
|
if (pfile->line_maps.depth >= CPP_STACK_MAX)
|
||||||
|
cpp_error (pfile, DL_ERROR, "#include nested too deeply");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
cpp_error (pfile, DL_ERROR, "#include nested too deeply");
|
/* Get out of macro context, if we are. */
|
||||||
return;
|
skip_rest_of_line (pfile);
|
||||||
|
|
||||||
|
if (pfile->cb.include)
|
||||||
|
(*pfile->cb.include) (pfile, pfile->directive_line,
|
||||||
|
pfile->directive->name, fname, angle_brackets);
|
||||||
|
|
||||||
|
_cpp_execute_include (pfile, fname, angle_brackets, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get out of macro context, if we are. */
|
free ((PTR) fname);
|
||||||
skip_rest_of_line (pfile);
|
|
||||||
|
|
||||||
if (pfile->cb.include)
|
|
||||||
(*pfile->cb.include) (pfile, pfile->directive_line,
|
|
||||||
pfile->directive->name, header);
|
|
||||||
|
|
||||||
_cpp_execute_include (pfile, header, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1305,27 +1302,27 @@ static void
|
||||||
do_pragma_dependency (pfile)
|
do_pragma_dependency (pfile)
|
||||||
cpp_reader *pfile;
|
cpp_reader *pfile;
|
||||||
{
|
{
|
||||||
const cpp_token *header;
|
const char *fname;
|
||||||
int ordering;
|
int angle_brackets, ordering;
|
||||||
|
|
||||||
header = parse_include (pfile);
|
fname = parse_include (pfile, &angle_brackets);
|
||||||
if (!header)
|
if (!fname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ordering = _cpp_compare_file_date (pfile, header);
|
ordering = _cpp_compare_file_date (pfile, fname, angle_brackets);
|
||||||
if (ordering < 0)
|
if (ordering < 0)
|
||||||
cpp_error (pfile, DL_WARNING, "cannot find source %s",
|
cpp_error (pfile, DL_WARNING, "cannot find source file %s", fname);
|
||||||
cpp_token_as_text (pfile, header));
|
|
||||||
else if (ordering > 0)
|
else if (ordering > 0)
|
||||||
{
|
{
|
||||||
cpp_error (pfile, DL_WARNING, "current file is older than %s",
|
cpp_error (pfile, DL_WARNING, "current file is older than %s", fname);
|
||||||
cpp_token_as_text (pfile, header));
|
|
||||||
if (cpp_get_token (pfile)->type != CPP_EOF)
|
if (cpp_get_token (pfile)->type != CPP_EOF)
|
||||||
{
|
{
|
||||||
_cpp_backup_tokens (pfile, 1);
|
_cpp_backup_tokens (pfile, 1);
|
||||||
do_diagnostic (pfile, DL_WARNING, 0);
|
do_diagnostic (pfile, DL_WARNING, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free ((PTR) fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a token but skip padding. */
|
/* Get a token but skip padding. */
|
||||||
|
|
|
@ -375,7 +375,7 @@ struct cpp_callbacks
|
||||||
void (*line_change) PARAMS ((cpp_reader *, const cpp_token *, int));
|
void (*line_change) PARAMS ((cpp_reader *, const cpp_token *, int));
|
||||||
void (*file_change) PARAMS ((cpp_reader *, const struct line_map *));
|
void (*file_change) PARAMS ((cpp_reader *, const struct line_map *));
|
||||||
void (*include) PARAMS ((cpp_reader *, unsigned int,
|
void (*include) PARAMS ((cpp_reader *, unsigned int,
|
||||||
const unsigned char *, const cpp_token *));
|
const unsigned char *, const char *, int));
|
||||||
void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||||
void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||||
void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *));
|
void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *));
|
||||||
|
|
Loading…
Reference in New Issue