aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-06-21 11:04:04 -0700
committerIan Lance Taylor <iant@golang.org>2023-06-21 11:04:04 -0700
commit97e31a0a2a2d2273687fcdb4e5416aab1a2186e1 (patch)
treed5c1cae4de436a0fe54a5f0a2a197d309f3d654c /libcpp/files.cc
parent6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (diff)
parent577223aebc7acdd31e62b33c1682fe54a622ae27 (diff)
downloadgcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.zip
gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.gz
gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.bz2
Merge from trunk revision 577223aebc7acdd31e62b33c1682fe54a622ae27.
Diffstat (limited to 'libcpp/files.cc')
-rw-r--r--libcpp/files.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/libcpp/files.cc b/libcpp/files.cc
index 3f8a810..43a8894 100644
--- a/libcpp/files.cc
+++ b/libcpp/files.cc
@@ -109,6 +109,10 @@ struct _cpp_file
/* If this file is implicitly preincluded. */
bool implicit_preinclude : 1;
+ /* Set if a header wasn't found with __has_include or __has_include_next
+ and error should be emitted if it is included normally. */
+ bool deferred_error : 1;
+
/* > 0: Known C++ Module header unit, <0: known not. ==0, unknown */
int header_unit : 2;
};
@@ -523,7 +527,14 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
cpp_file_hash_entry *entry
= search_cache ((struct cpp_file_hash_entry *) *hash_slot, start_dir);
if (entry)
- return entry->u.file;
+ {
+ if (entry->u.file->deferred_error && kind == _cpp_FFK_NORMAL)
+ {
+ open_file_failed (pfile, entry->u.file, angle_brackets, loc);
+ entry->u.file->deferred_error = false;
+ }
+ return entry->u.file;
+ }
_cpp_file *file = make_cpp_file (start_dir, fname);
file->implicit_preinclude
@@ -589,6 +600,8 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
if (kind != _cpp_FFK_HAS_INCLUDE)
open_file_failed (pfile, file, angle_brackets, loc);
+ else
+ file->deferred_error = true;
break;
}