Commit 6568f34b by James E Wilson Committed by Jim Wilson

Fix bug with -MM -MG.

PR preprocessor/15220
* files.c (_cpp_find_file): New parameter angle_brackets.  Fix all
callers.  Pass to open_file_failed.
(open_file_failed): New parameter angle_brackets.  Fix all callers.
Use in print_dep assignment.
* init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file.
* internal.h (_cpp_find_file): Add new parm to declaration.

From-SVN: r105757
parent 960d3502
2005-10-14 James E Wilson <wilson@specifix.com>
PR preprocessor/15220
* files.c (_cpp_find_file): New parameter angle_brackets. Fix all
callers. Pass to open_file_failed.
(open_file_failed): New parameter angle_brackets. Fix all callers.
Use in print_dep assignment.
* init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file.
* internal.h (_cpp_find_file): Add new parm to declaration.
2005-10-08 Kazu Hirata <kazu@codesourcery.com> 2005-10-08 Kazu Hirata <kazu@codesourcery.com>
* configure.ac: Require 64-bit int for arm*-*-*eabi*. * configure.ac: Require 64-bit int for arm*-*-*eabi*.
......
...@@ -158,7 +158,7 @@ static bool should_stack_file (cpp_reader *, _cpp_file *file, bool import); ...@@ -158,7 +158,7 @@ static bool should_stack_file (cpp_reader *, _cpp_file *file, bool import);
static struct cpp_dir *search_path_head (cpp_reader *, const char *fname, static struct cpp_dir *search_path_head (cpp_reader *, const char *fname,
int angle_brackets, enum include_type); int angle_brackets, enum include_type);
static const char *dir_name_of_file (_cpp_file *file); static const char *dir_name_of_file (_cpp_file *file);
static void open_file_failed (cpp_reader *pfile, _cpp_file *file); static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int);
static struct file_hash_entry *search_cache (struct file_hash_entry *head, static struct file_hash_entry *search_cache (struct file_hash_entry *head,
const cpp_dir *start_dir); const cpp_dir *start_dir);
static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname); static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname);
...@@ -331,7 +331,7 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) ...@@ -331,7 +331,7 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch)
if (file->err_no != ENOENT) if (file->err_no != ENOENT)
{ {
open_file_failed (pfile, file); open_file_failed (pfile, file, 0);
return true; return true;
} }
...@@ -391,7 +391,7 @@ _cpp_find_failed (_cpp_file *file) ...@@ -391,7 +391,7 @@ _cpp_find_failed (_cpp_file *file)
to open_file(). to open_file().
*/ */
_cpp_file * _cpp_file *
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool fake) _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool fake, int angle_brackets)
{ {
struct file_hash_entry *entry, **hash_slot; struct file_hash_entry *entry, **hash_slot;
_cpp_file *file; _cpp_file *file;
...@@ -433,7 +433,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f ...@@ -433,7 +433,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
return file; return file;
} }
open_file_failed (pfile, file); open_file_failed (pfile, file, angle_brackets);
if (invalid_pch) if (invalid_pch)
{ {
cpp_error (pfile, CPP_DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
...@@ -575,7 +575,7 @@ read_file (cpp_reader *pfile, _cpp_file *file) ...@@ -575,7 +575,7 @@ read_file (cpp_reader *pfile, _cpp_file *file)
if (file->fd == -1 && !open_file (file)) if (file->fd == -1 && !open_file (file))
{ {
open_file_failed (pfile, file); open_file_failed (pfile, file, 0);
return false; return false;
} }
...@@ -817,7 +817,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets, ...@@ -817,7 +817,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
if (!dir) if (!dir)
return false; return false;
file = _cpp_find_file (pfile, fname, dir, false); file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
/* Compensate for the increment in linemap_add. In the case of a /* Compensate for the increment in linemap_add. In the case of a
normal #include, we're currently at the start of the line normal #include, we're currently at the start of the line
...@@ -834,10 +834,10 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets, ...@@ -834,10 +834,10 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
/* Could not open FILE. The complication is dependency output. */ /* Could not open FILE. The complication is dependency output. */
static void static void
open_file_failed (cpp_reader *pfile, _cpp_file *file) open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets)
{ {
int sysp = pfile->line_table->highest_line > 1 && pfile->buffer ? pfile->buffer->sysp : 0; int sysp = pfile->line_table->highest_line > 1 && pfile->buffer ? pfile->buffer->sysp : 0;
bool print_dep = CPP_OPTION (pfile, deps.style) > !!sysp; bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || !!sysp);
errno = file->err_no; errno = file->err_no;
if (print_dep && CPP_OPTION (pfile, deps.missing_files) && errno == ENOENT) if (print_dep && CPP_OPTION (pfile, deps.missing_files) && errno == ENOENT)
...@@ -1020,7 +1020,7 @@ _cpp_cleanup_files (cpp_reader *pfile) ...@@ -1020,7 +1020,7 @@ _cpp_cleanup_files (cpp_reader *pfile)
void void
_cpp_fake_include (cpp_reader *pfile, const char *fname) _cpp_fake_include (cpp_reader *pfile, const char *fname)
{ {
_cpp_find_file (pfile, fname, pfile->buffer->file->dir, true); _cpp_find_file (pfile, fname, pfile->buffer->file->dir, true, 0);
} }
/* Not everyone who wants to set system-header-ness on a buffer can /* Not everyone who wants to set system-header-ness on a buffer can
...@@ -1105,7 +1105,7 @@ _cpp_compare_file_date (cpp_reader *pfile, const char *fname, ...@@ -1105,7 +1105,7 @@ _cpp_compare_file_date (cpp_reader *pfile, const char *fname,
if (!dir) if (!dir)
return -1; return -1;
file = _cpp_find_file (pfile, fname, dir, false); file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
if (file->err_no) if (file->err_no)
return -1; return -1;
...@@ -1479,7 +1479,7 @@ _cpp_save_file_entries (cpp_reader *pfile, FILE *fp) ...@@ -1479,7 +1479,7 @@ _cpp_save_file_entries (cpp_reader *pfile, FILE *fp)
if (!open_file (f)) if (!open_file (f))
{ {
open_file_failed (pfile, f); open_file_failed (pfile, f, 0);
return false; return false;
} }
ff = fdopen (f->fd, "rb"); ff = fdopen (f->fd, "rb");
......
...@@ -467,7 +467,7 @@ cpp_read_main_file (cpp_reader *pfile, const char *fname) ...@@ -467,7 +467,7 @@ cpp_read_main_file (cpp_reader *pfile, const char *fname)
} }
pfile->main_file pfile->main_file
= _cpp_find_file (pfile, fname, &pfile->no_search_path, false); = _cpp_find_file (pfile, fname, &pfile->no_search_path, false, 0);
if (_cpp_find_failed (pfile->main_file)) if (_cpp_find_failed (pfile->main_file))
return NULL; return NULL;
......
...@@ -503,8 +503,8 @@ extern void _cpp_destroy_hashtable (cpp_reader *); ...@@ -503,8 +503,8 @@ extern void _cpp_destroy_hashtable (cpp_reader *);
/* In files.c */ /* In files.c */
typedef struct _cpp_file _cpp_file; typedef struct _cpp_file _cpp_file;
extern _cpp_file *_cpp_find_file (cpp_reader *, const char *fname, extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *,
cpp_dir *start_dir, bool fake); bool, int);
extern bool _cpp_find_failed (_cpp_file *); extern bool _cpp_find_failed (_cpp_file *);
extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *); extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
extern void _cpp_fake_include (cpp_reader *, const char *); extern void _cpp_fake_include (cpp_reader *, const char *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment