diff mbox series

[16/39] tst-printf-bz18872.sh: stdio: Use __attribute__ ((optnone)) for Clang

Message ID 20241222000509.2205895-17-hjl.tools@gmail.com
State Accepted
Commit d085db5b57c71c3ee2fbfc38a4f7e2158abeb1d4
Headers show
Series [01/39] conform: Use -dD instead of -dN on compiler invocation | expand

Commit Message

H.J. Lu Dec. 22, 2024, 12:04 a.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

Use

__attribute__ ((optnone))

instead of

__attribute__ ((optimize ("-O0")))

to disable optimization for Clang.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
---
 stdio-common/tst-printf-bz18872.sh | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Sam James Dec. 22, 2024, 4:32 a.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> Use
>
> __attribute__ ((optnone))
>
> instead of
>
> __attribute__ ((optimize ("-O0")))
>
> to disable optimization for Clang.

Reviewed-by: Sam James <sam@gentoo.org>

>
> Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
> ---
>  stdio-common/tst-printf-bz18872.sh | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/stdio-common/tst-printf-bz18872.sh b/stdio-common/tst-printf-bz18872.sh
> index 3b283f49a6..ade4b61f85 100644
> --- a/stdio-common/tst-printf-bz18872.sh
> +++ b/stdio-common/tst-printf-bz18872.sh
> @@ -31,7 +31,11 @@ cat <<'EOF'
>    Compile do_test without optimization: GCC 4.9/5.0/6.0 takes a long time
>    to build this source. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67396  */

The GCC bug claims that 6 works fine. We should revisit this if/when we
increase the baseline.

>  
> +#ifdef __clang__
> +__attribute__ ((optnone))
> +#else
>  __attribute__ ((optimize ("-O0")))
> +#endif

OK.

>  int do_test (void)
>  {
>      mtrace ();
diff mbox series

Patch

diff --git a/stdio-common/tst-printf-bz18872.sh b/stdio-common/tst-printf-bz18872.sh
index 3b283f49a6..ade4b61f85 100644
--- a/stdio-common/tst-printf-bz18872.sh
+++ b/stdio-common/tst-printf-bz18872.sh
@@ -31,7 +31,11 @@  cat <<'EOF'
   Compile do_test without optimization: GCC 4.9/5.0/6.0 takes a long time
   to build this source. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67396  */
 
+#ifdef __clang__
+__attribute__ ((optnone))
+#else
 __attribute__ ((optimize ("-O0")))
+#endif
 int do_test (void)
 {
     mtrace ();