diff mbox series

Handle pragma GCC optimize for clang

Message ID 20241221223355.754081-1-hjl.tools@gmail.com
State Superseded
Headers show
Series Handle pragma GCC optimize for clang | expand

Commit Message

H.J. Lu Dec. 21, 2024, 10:33 p.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

For Clang, use

 #pragma clang optimize off

instead of

 #pragma GCC optimize("O0")
---
 libio/tst-bz24051.c | 6 +++++-
 libio/tst-bz24153.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libio/tst-bz24051.c b/libio/tst-bz24051.c
index a9903f20a3..2d32aae74a 100644
--- a/libio/tst-bz24051.c
+++ b/libio/tst-bz24051.c
@@ -19,7 +19,11 @@ 
 
 /* Prevent putchar -> _IO_putc inline expansion.  */
 #define __NO_INLINE__
-#pragma GCC optimize("O0")
+#ifdef __clang__
+# pragma clang optimize off
+#else
+# pragma GCC optimize("O0")
+#endif
 
 #include <stdio.h>
 #include <string.h>
diff --git a/libio/tst-bz24153.c b/libio/tst-bz24153.c
index 023f07ca20..c379876fcc 100644
--- a/libio/tst-bz24153.c
+++ b/libio/tst-bz24153.c
@@ -18,7 +18,11 @@ 
 
 /* Prevent getchar -> getc inline expansion.  */
 #define __NO_INLINE__
-#pragma GCC optimize ("O0")
+#ifdef __clang__
+# pragma clang optimize off
+#else
+# pragma GCC optimize("O0")
+#endif
 
 #include <stdarg.h>
 #include <stdio.h>