diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 84e195cd88d4d50501e6d348ad64b2262e442eb4..a1805f854421e3fc4fab251bfd2089b741d829bc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+	PR preprocessor/88974
+	* c-c++-common/cpp/pr88974.c: New test.
+
 2019-01-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	PR c++/88969
diff --git a/gcc/testsuite/c-c++-common/cpp/pr88974.c b/gcc/testsuite/c-c++-common/cpp/pr88974.c
new file mode 100644
index 0000000000000000000000000000000000000000..c375d83c75f1f4e2312785b5ad868fe35480d35a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr88974.c
@@ -0,0 +1,6 @@
+/* PR preprocessor/88974 */
+/* { dg-do preprocess } */
+
+#if __has_include (<pr88974.h)
+/* { dg-error "missing terminating > character" "" { target *-*-* } .-1 } */
+#endif
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index eec6a57aef5bc69c0cd54440aac3d3325c018b29..ae05d6be9a6bc8f807bb8274693a229f79c2a3b0 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+	PR preprocessor/88974
+	* directives.c (SEEN_EOL): Move macro to ...
+	* internal.h (SEEN_EOL): ... here.
+	* expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().
+
 2019-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 1a35c0768b06833cb66d81becec64cf36048e229..1ada834da17482ebd75fd9ed57312b0e41cd24a7 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -204,8 +204,6 @@ static const directive linemarker_dir =
   do_linemarker, UC"#", 1, KANDR, IN_I
 };
 
-#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
-
 /* Skip any remaining tokens in a directive.  */
 static void
 skip_rest_of_line (cpp_reader *pfile)
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 6ab5493d089565870d8a0b48a6e0c67e78c1d42b..d8438a5bb75fd2620e40323c3a5ea4108c73cebb 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -2238,7 +2238,7 @@ parse_has_include (cpp_reader *pfile, enum include_type type)
       XDELETEVEC (fname);
     }
 
-  if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
+  if (paren && !SEEN_EOL () && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
     cpp_error (pfile, CPP_DL_ERROR,
 	       "missing ')' after \"__has_include__\"");
 
diff --git a/libcpp/internal.h b/libcpp/internal.h
index 0bd7df985854868c7537dbd38aeb803f005d0896..77a2a3becb31fd33829af36ba161493bf11412f2 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -593,6 +593,8 @@ struct cpp_reader
 #define is_nvspace(x)	IS_NVSPACE(x)
 #define is_space(x)	IS_SPACE_OR_NUL(x)
 
+#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
+
 /* This table is constant if it can be initialized at compile time,
    which is the case if cpp was compiled with GCC >=2.7, or another
    compiler that supports C99.  */