[08/11] libctf: work with compilers not supporting GNU C attributes

Message ID 20191216225357.87247-9-nick.alcock@oracle.com
State New
Headers show
Series
  • libctf: various portability fixes and small bugfixes
Related show

Commit Message

Nick Alcock Dec. 16, 2019, 10:53 p.m.
The obvious fallback __attribute__ stanza was missing.

Thanks to Harald van Dijk.

	PR 25120
libctf/
	* ctf-impl.h (_libctf_printflike_): Add non-GNU-C fallback.
	(_libctf_unlikely_): Likewise.
	(_libctf_unused): Likewise.
	(_libctf_malloc_): Likewise.
---
 libctf/ChangeLog  | 8 ++++++++
 libctf/ctf-impl.h | 7 +++++++
 2 files changed, 15 insertions(+)

-- 
2.24.1.242.gb57e918ca5

Patch

diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 7b0e9e6fa7..7550015cab 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,11 @@ 
+2019-12-16  Nick Alcock  <nick.alcock@oracle.com>
+
+	PR libctf/25120
+	* ctf-impl.h (_libctf_printflike_): Add non-GNU-C fallback.
+	(_libctf_unlikely_): Likewise.
+	(_libctf_unused): Likewise.
+	(_libctf_malloc_): Likewise.
+
 2019-12-16  Nick Alcock  <nick.alcock@oracle.com>
 
 	PR libctf/25120
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index de855b5883..5a2ad464ae 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -59,6 +59,13 @@  extern "C"
 #define _libctf_unused_ __attribute__ ((__unused__))
 #define _libctf_malloc_ __attribute__((__malloc__))
 
+#else
+
+#define _libctf_printflike_(string_index,first_to_check)
+#define _libctf_unlikely_(x) (x)
+#define _libctf_unused_
+#define _libctf_malloc_
+
 #endif
 
 /* libctf in-memory state.  */