--- /dev/null
+/* { dg-do preprocess } */
+#include "pr61474.h"
+/* Make sure that the file can be included for real, after it was
+ fake-included by the linemarker directives in pr61474.h. */
+#include "pr61474-2.h"
--- /dev/null
+/* Create a fake include for pr61474-2.h and exercise looking it up. */
+/* Use #pragma once to check also that the fake-include entry in the file
+ cache does not cause a problem in libcpp/files.cc:has_unique_contents(). */
+#pragma once
+# 1 "pr61474-2.h" 1
+# 2 "pr61474-2.h" 1
= (kind == _cpp_FFK_PRE_INCLUDE
|| (pfile->buffer && pfile->buffer->file->implicit_preinclude));
- if (kind != _cpp_FFK_FAKE)
+ if (kind == _cpp_FFK_FAKE)
+ file->dont_read = true;
+ else
/* Try each path in the include chain. */
for (;;)
{
void
_cpp_fake_include (cpp_reader *pfile, const char *fname)
{
- _cpp_find_file (pfile, fname, pfile->buffer->file->dir, 0, _cpp_FFK_FAKE, 0);
+ /* It does not matter what are the contents of fake_source_dir, it will never
+ be inspected; we just use its address to uniquely signify that this file
+ was added as a fake include, so a later call to _cpp_find_file (to include
+ the file for real) won't find the fake one in the hash table. */
+ static cpp_dir fake_source_dir;
+ _cpp_find_file (pfile, fname, &fake_source_dir, 0, _cpp_FFK_FAKE, 0);
}
/* Not everyone who wants to set system-header-ness on a buffer can