public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] enable __GXX_WEAK__ when using weak for one-only
@ 2022-11-25 5:13 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-11-25 5:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:79ccdb557f8207dfebc9a9fb541193deeec559f0
commit 79ccdb557f8207dfebc9a9fb541193deeec559f0
Author: Alexandre Oliva <oliva@gnu.org>
Date: Fri Nov 25 02:06:46 2022 -0300
enable __GXX_WEAK__ when using weak for one-only
Diff:
---
gcc/c-family/c-cppbuiltin.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 333f3e138d6..15ef47c0c04 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -939,7 +939,15 @@ c_cpp_builtins (cpp_reader *pfile)
if (c_dialect_cxx ())
{
- if (flag_weak && SUPPORTS_ONE_ONLY)
+ /* __GXX_WEAK__'s name is misleading, the documentation says it
+ tests for one-only spuport, but SUPPORTS_ONE_ONLY is also
+ slightly misleading, because weak symbols can be used for
+ one-only support even if !SUPPORtS_ONE_ONLY. Here we
+ approximate the supprots_one_only() test that may clear
+ flag_weak, but we use the flag_weak result instead of
+ TARGET_SUPPORTS_WEAK, because the user may have disabled weak
+ symbols with -fno-weak. */
+ if (flag_weak || SUPPORTS_ONE_ONLY)
cpp_define (pfile, "__GXX_WEAK__=1");
else
cpp_define (pfile, "__GXX_WEAK__=0");
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] enable __GXX_WEAK__ when using weak for one-only
@ 2022-11-25 6:34 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-11-25 6:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:bd755025008d7d020a9eea266255ffe1d0dfb892
commit bd755025008d7d020a9eea266255ffe1d0dfb892
Author: Alexandre Oliva <oliva@gnu.org>
Date: Fri Nov 25 02:06:46 2022 -0300
enable __GXX_WEAK__ when using weak for one-only
Diff:
---
gcc/c-family/c-cppbuiltin.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 333f3e138d6..15ef47c0c04 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -939,7 +939,15 @@ c_cpp_builtins (cpp_reader *pfile)
if (c_dialect_cxx ())
{
- if (flag_weak && SUPPORTS_ONE_ONLY)
+ /* __GXX_WEAK__'s name is misleading, the documentation says it
+ tests for one-only spuport, but SUPPORTS_ONE_ONLY is also
+ slightly misleading, because weak symbols can be used for
+ one-only support even if !SUPPORtS_ONE_ONLY. Here we
+ approximate the supprots_one_only() test that may clear
+ flag_weak, but we use the flag_weak result instead of
+ TARGET_SUPPORTS_WEAK, because the user may have disabled weak
+ symbols with -fno-weak. */
+ if (flag_weak || SUPPORTS_ONE_ONLY)
cpp_define (pfile, "__GXX_WEAK__=1");
else
cpp_define (pfile, "__GXX_WEAK__=0");
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-25 6:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 5:13 [gcc(refs/users/aoliva/heads/testme)] enable __GXX_WEAK__ when using weak for one-only Alexandre Oliva
2022-11-25 6:34 Alexandre Oliva
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).