aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-26 10:08:00 +0000
committerJakub Jelinek <jakub@redhat.com>2019-01-26 10:08:00 +0000
commit17098b56dfa6d598dc6e622287893f0b3d165b02 (patch)
tree9c09a82425d5c1d2c2859f73f4ca6281c4a446b8 /libcpp
parentf1c3a7d3d7f9c0de2aba1406fac83762666060b5 (diff)
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 (). * c-c++-common/cpp/pr88974.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@268285 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog7
-rw-r--r--libcpp/directives.c2
-rw-r--r--libcpp/expr.c2
-rw-r--r--libcpp/internal.h2
4 files changed, 10 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index eec6a57aef5..ae05d6be9a6 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 1a35c0768b0..1ada834da17 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 6ab5493d089..d8438a5bb75 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 0bd7df98585..77a2a3becb3 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. */