* [LTP] [PATCH] open_posix_testsuite: Avoid non portable GCC extensions without a guard
@ 2024-05-05 11:04 Detlef Riekenberg via ltp
2024-05-07 16:07 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Detlef Riekenberg via ltp @ 2024-05-05 11:04 UTC (permalink / raw)
To: ltp
The GCC extension "__attribute__" breaks other compiler
and produces 458 test failures.
--
Regards ... Detlef
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
---
.../open_posix_testsuite/include/posixtest.h | 27 ++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/testcases/open_posix_testsuite/include/posixtest.h b/testcases/open_posix_testsuite/include/posixtest.h
index d1b298488..07979b736 100644
--- a/testcases/open_posix_testsuite/include/posixtest.h
+++ b/testcases/open_posix_testsuite/include/posixtest.h
@@ -20,9 +20,30 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
-#define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn))
-#define PTS_ATTRIBUTE_UNUSED __attribute__((unused))
-#define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
+/* __attribute__ is a non portable gcc extension */
+/* TODO: Add support for C23 attributes */
+#if defined __has_attribute
+# if __has_attribute(noreturn)
+# define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn))
+# endif
+# if __has_attribute(unused)
+# define PTS_ATTRIBUTE_UNUSED __attribute__((unused))
+# endif
+# if __has_attribute(warn_unused_result)
+# define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
+# endif
+#endif
+
+#ifndef PTS_ATTRIBUTE_NORETURN
+#define PTS_ATTRIBUTE_NORETURN
+#endif
+#ifndef PTS_ATTRIBUTE_UNUSED
+#define PTS_ATTRIBUTE_UNUSED
+#endif
+#ifndef PTS_ATTRIBUTE_UNUSED_RESULT
+#define PTS_ATTRIBUTE_UNUSED_RESULT
+#endif
+
#define PTS_WRITE_MSG(msg) do { \
if (write(STDOUT_FILENO, msg, sizeof(msg) - 1)) { \
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] open_posix_testsuite: Avoid non portable GCC extensions without a guard
2024-05-05 11:04 [LTP] [PATCH] open_posix_testsuite: Avoid non portable GCC extensions without a guard Detlef Riekenberg via ltp
@ 2024-05-07 16:07 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2024-05-07 16:07 UTC (permalink / raw)
To: Detlef Riekenberg; +Cc: ltp
Hi!
Pushed with a minor whitespace changes, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-07 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-05 11:04 [LTP] [PATCH] open_posix_testsuite: Avoid non portable GCC extensions without a guard Detlef Riekenberg via ltp
2024-05-07 16:07 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox