From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH] libstdc++: Make <stdatomic.h> forward to C version if included by C
Date: Thu, 12 Jan 2023 21:04:01 +0000 [thread overview]
Message-ID: <20230112210401.932343-1-jwakely@redhat.com> (raw)
I was asked about this privately. I don't really like that it would ever
be needed, but it also seems fairly harmless. We already do similar
things for some of the libstdc++ versions of <stdlib.h> etc.
Any objections?
Tested x86_64-linux.
-- >8 --
This shouldn't be needed, but apparently the Bazel build tool has a
misfeature where it uses -nostdinc and explicitly provides the system
include paths, and it uses the same set of paths for compiling C and C++
code. This means that the libstdc++ header paths get used when compiling
C code, and so our new <stdatomic.h> gets included.
Just forward to the C header using #include_next if that happens.
libstdc++-v3/ChangeLog:
* include/c_compatibility/stdatomic.h: Use #include_next if
included by C code.
---
libstdc++-v3/include/c_compatibility/stdatomic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
index a51a84c2054..aa7bbb923dc 100644
--- a/libstdc++-v3/include/c_compatibility/stdatomic.h
+++ b/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -124,7 +124,7 @@ using std::atomic_flag_clear_explicit;
using std::atomic_thread_fence;
using std::atomic_signal_fence;
-#elif defined __clang__
+#elif !defined __cplusplus || defined __clang__
# include_next <stdatomic.h>
#endif // C++23
#endif // _GLIBCXX_STDATOMIC_H
--
2.39.0
reply other threads:[~2023-01-12 21:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230112210401.932343-1-jwakely@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).