* [PATCH 0/2] cpp: fix __has_include in traditional mode
@ 2020-07-28 7:28 Tiziano Müller
2020-07-28 7:28 ` [PATCH 1/2] libcpp: fix __has_include handling with traditional-cpp Tiziano Müller
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tiziano Müller @ 2020-07-28 7:28 UTC (permalink / raw)
To: gcc-patches; +Cc: Tiziano Müller
Hi there,
this patch intends to fix the regression introduced in gcc 10 with __has_include,
see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Best,
Tiziano
Tiziano Müller (2):
libcpp: fix __has_include handling with traditional-cpp
[testsuite] add tests for __has_include with traditional-cpp
gcc/testsuite/ChangeLog | 4 ++
.../cpp/has-include-1-traditional.c | 38 +++++++++++++++++++
libcpp/init.c | 3 ++
libcpp/traditional.c | 4 +-
4 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c
--
2.26.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] libcpp: fix __has_include handling with traditional-cpp
2020-07-28 7:28 [PATCH 0/2] cpp: fix __has_include in traditional mode Tiziano Müller
@ 2020-07-28 7:28 ` Tiziano Müller
2020-07-28 7:28 ` [PATCH 2/2] [testsuite] add tests for __has_include " Tiziano Müller
2020-07-29 12:52 ` [PATCH 0/2] cpp: fix __has_include in traditional mode Nathan Sidwell
2 siblings, 0 replies; 5+ messages in thread
From: Tiziano Müller @ 2020-07-28 7:28 UTC (permalink / raw)
To: gcc-patches; +Cc: Tiziano Müller
fixes #95889
---
libcpp/init.c | 3 +++
libcpp/traditional.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libcpp/init.c b/libcpp/init.c
index 0aac5acd0a3..b0cf7119258 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -400,6 +400,9 @@ static const struct builtin_macro builtin_array[] =
B("__LINE__", BT_SPECLINE, true),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL, true),
B("__COUNTER__", BT_COUNTER, true),
+ /* Make sure to update the list of built-in
+ function-like macros in traditional.c:
+ fun_like_macro() when adding more following */
B("__has_attribute", BT_HAS_ATTRIBUTE, true),
B("__has_cpp_attribute", BT_HAS_ATTRIBUTE, true),
B("__has_builtin", BT_HAS_BUILTIN, true),
diff --git a/libcpp/traditional.c b/libcpp/traditional.c
index 77adb3bf595..b087072c9b4 100644
--- a/libcpp/traditional.c
+++ b/libcpp/traditional.c
@@ -330,7 +330,9 @@ fun_like_macro (cpp_hashnode *node)
{
if (cpp_builtin_macro_p (node))
return (node->value.builtin == BT_HAS_ATTRIBUTE
- || node->value.builtin == BT_HAS_BUILTIN);
+ || node->value.builtin == BT_HAS_BUILTIN
+ || node->value.builtin == BT_HAS_INCLUDE
+ || node->value.builtin == BT_HAS_INCLUDE_NEXT);
return node->value.macro->fun_like;
}
--
2.26.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] [testsuite] add tests for __has_include with traditional-cpp
2020-07-28 7:28 [PATCH 0/2] cpp: fix __has_include in traditional mode Tiziano Müller
2020-07-28 7:28 ` [PATCH 1/2] libcpp: fix __has_include handling with traditional-cpp Tiziano Müller
@ 2020-07-28 7:28 ` Tiziano Müller
2020-07-29 12:52 ` [PATCH 0/2] cpp: fix __has_include in traditional mode Nathan Sidwell
2 siblings, 0 replies; 5+ messages in thread
From: Tiziano Müller @ 2020-07-28 7:28 UTC (permalink / raw)
To: gcc-patches; +Cc: Tiziano Müller
---
gcc/testsuite/ChangeLog | 4 ++
.../cpp/has-include-1-traditional.c | 38 +++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 477804eec9b..18f81e1befa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-27 Tiziano Müller <tiziano.mueller@chem.uzh.ch>
+
+ * c-c++-common/cpp/has-include-1-traditional.c: New test.
+
2020-07-27 Hans-Peter Nilsson <hp@bitrange.com>
* gcc.dg/tree-ssa/reassoc-20.c: Adjust for mmix.
diff --git a/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c b/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c
new file mode 100644
index 00000000000..b0acdbece4d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c
@@ -0,0 +1,38 @@
+/* { dg-do preprocess { target c } } */
+/* { dg-options "-traditional-cpp" } */
+
+#if __has_include ("stdlib.h")
+#else
+#error error 1
+#endif
+#if __has_include (<stdlib.h>)
+#else
+#error error 2
+#endif
+#if !__has_include ("stdlib.h")
+#error error 3
+#elif !__has_include (<stdlib.h>)
+#error error 4
+#endif
+#if __has_include ("stdlib.h") && __has_include (<stdlib.h>)
+#else
+#error error 5
+#endif
+#if !defined(__has_include)
+#error error 6
+#endif
+#ifndef __has_include
+#error error 7
+#endif
+#ifdef __has_include
+#else
+#error error 8
+#endif
+#define m1 __has_include("stdlib.h")
+#define m2 <stdlib.h>
+#if !m1
+#error error 9
+#endif
+#if !__has_include (m2)
+#error error 13
+#endif
--
2.26.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] cpp: fix __has_include in traditional mode
2020-07-28 7:28 [PATCH 0/2] cpp: fix __has_include in traditional mode Tiziano Müller
2020-07-28 7:28 ` [PATCH 1/2] libcpp: fix __has_include handling with traditional-cpp Tiziano Müller
2020-07-28 7:28 ` [PATCH 2/2] [testsuite] add tests for __has_include " Tiziano Müller
@ 2020-07-29 12:52 ` Nathan Sidwell
2020-07-29 13:15 ` Tiziano Müller
2 siblings, 1 reply; 5+ messages in thread
From: Nathan Sidwell @ 2020-07-29 12:52 UTC (permalink / raw)
To: Tiziano Müller, gcc-patches
On 7/28/20 3:28 AM, Tiziano Müller wrote:
> Hi there,
>
> this patch intends to fix the regression introduced in gcc 10 with __has_include,
> see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Thanks, do you have write access? I don't see your name in MAINTAINERS.
[for avoidance of doubt, this is sufficiently restricted I'm not
concerned with copyright assignment, there is only one way to write this
change]
nathan
>
> Best,
> Tiziano
>
> Tiziano Müller (2):
> libcpp: fix __has_include handling with traditional-cpp
> [testsuite] add tests for __has_include with traditional-cpp
>
> gcc/testsuite/ChangeLog | 4 ++
> .../cpp/has-include-1-traditional.c | 38 +++++++++++++++++++
> libcpp/init.c | 3 ++
> libcpp/traditional.c | 4 +-
> 4 files changed, 48 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c
>
--
Nathan Sidwell
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] cpp: fix __has_include in traditional mode
2020-07-29 12:52 ` [PATCH 0/2] cpp: fix __has_include in traditional mode Nathan Sidwell
@ 2020-07-29 13:15 ` Tiziano Müller
0 siblings, 0 replies; 5+ messages in thread
From: Tiziano Müller @ 2020-07-29 13:15 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: gcc-patches
Hi Nathan,
On 29.07.20 14:52, Nathan Sidwell wrote:
> On 7/28/20 3:28 AM, Tiziano Müller wrote:
>> Hi there,
>>
>> this patch intends to fix the regression introduced in gcc 10 with
>> __has_include,
>> see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
>
> Thanks, do you have write access? I don't see your name in MAINTAINERS.
No, I don't.
> [for avoidance of doubt, this is sufficiently restricted I'm not
> concerned with copyright assignment, there is only one way to write this
> change]
Me neither, just glad to get this fixed ;-)
Best,
Tiziano
--
Tiziano Müller
University of Zurich
Department of Chemistry
Winterthurerstrasse 190
CH-8057 Zürich
Tel: +41 44 63 54234
www.chem.uzh.ch
tiziano.mueller@chem.uzh.ch
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-29 13:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 7:28 [PATCH 0/2] cpp: fix __has_include in traditional mode Tiziano Müller
2020-07-28 7:28 ` [PATCH 1/2] libcpp: fix __has_include handling with traditional-cpp Tiziano Müller
2020-07-28 7:28 ` [PATCH 2/2] [testsuite] add tests for __has_include " Tiziano Müller
2020-07-29 12:52 ` [PATCH 0/2] cpp: fix __has_include in traditional mode Nathan Sidwell
2020-07-29 13:15 ` Tiziano Müller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).