public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] gcov: Fix __LIBGCC_HAVE_LIBATOMIC definition
@ 2023-11-30 16:20 Sebastian Huber
  2023-12-01  6:56 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Huber @ 2023-11-30 16:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Matthias Klose

In libgcov we use defined (__LIBGCC_HAVE_LIBATOMIC), so we must define it only
if needed (vs. #if __LIBGCC_HAVE_LIBATOMIC).

gcc/c-family/ChangeLog:

	PR target/112777

	* c-cppbuiltin.cc (c_cpp_builtins):  Define __LIBGCC_HAVE_LIBATOMIC
	only if targetm.have_libatomic is true.
---
 gcc/c-family/c-cppbuiltin.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index e536429fa4c..f8ec6f1747c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1570,8 +1570,8 @@ c_cpp_builtins (cpp_reader *pfile)
       /* For libgcov.  */
       builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__",
 				     TARGET_VTABLE_USES_DESCRIPTORS);
-      builtin_define_with_int_value ("__LIBGCC_HAVE_LIBATOMIC",
-				     targetm.have_libatomic);
+      if (targetm.have_libatomic)
+	cpp_define (pfile, "__LIBGCC_HAVE_LIBATOMIC");
     }
 
   /* For use in assembly language.  */
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gcov: Fix __LIBGCC_HAVE_LIBATOMIC definition
  2023-11-30 16:20 [PATCH] gcov: Fix __LIBGCC_HAVE_LIBATOMIC definition Sebastian Huber
@ 2023-12-01  6:56 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-12-01  6:56 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gcc-patches, Matthias Klose

On Thu, Nov 30, 2023 at 5:21 PM Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>
> In libgcov we use defined (__LIBGCC_HAVE_LIBATOMIC), so we must define it only
> if needed (vs. #if __LIBGCC_HAVE_LIBATOMIC).

For consistency wouldn't it be better to change the user side in libgcc?

> gcc/c-family/ChangeLog:
>
>         PR target/112777
>
>         * c-cppbuiltin.cc (c_cpp_builtins):  Define __LIBGCC_HAVE_LIBATOMIC
>         only if targetm.have_libatomic is true.
> ---
>  gcc/c-family/c-cppbuiltin.cc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
> index e536429fa4c..f8ec6f1747c 100644
> --- a/gcc/c-family/c-cppbuiltin.cc
> +++ b/gcc/c-family/c-cppbuiltin.cc
> @@ -1570,8 +1570,8 @@ c_cpp_builtins (cpp_reader *pfile)
>        /* For libgcov.  */
>        builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__",
>                                      TARGET_VTABLE_USES_DESCRIPTORS);
> -      builtin_define_with_int_value ("__LIBGCC_HAVE_LIBATOMIC",
> -                                    targetm.have_libatomic);
> +      if (targetm.have_libatomic)
> +       cpp_define (pfile, "__LIBGCC_HAVE_LIBATOMIC");
>      }
>
>    /* For use in assembly language.  */
> --
> 2.35.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-01  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 16:20 [PATCH] gcov: Fix __LIBGCC_HAVE_LIBATOMIC definition Sebastian Huber
2023-12-01  6:56 ` Richard Biener

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).