[Libguestfs] [nbdkit PATCH 2/2] include: Properly decorate attributes in public headers

Eric Blake eblake at redhat.com
Tue Jan 23 16:24:12 UTC 2018


gcc and clang intentionally support __decorated__ forms of all
attribute arguments (in the namespace reserved to the compiler
implementation), precisely so that any public header does
not risk mis-compilation in the face of a language-compliant
user-defined macro that collides with the bare-word counterpart.

We don't have to decorate our attribute usage in .c files,
because there we are in control of making sure no collisions
will interfere.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 include/nbdkit-common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h
index 3177878..5e69579 100644
--- a/include/nbdkit-common.h
+++ b/include/nbdkit-common.h
@@ -51,10 +51,10 @@ extern "C" {
 #define NBDKIT_THREAD_MODEL_PARALLEL                  3

 extern void nbdkit_error (const char *msg, ...)
-  __attribute__((format (printf, 1, 2)));
+  __attribute__((__format__ (__printf__, 1, 2)));
 extern void nbdkit_verror (const char *msg, va_list args);
 extern void nbdkit_debug (const char *msg, ...)
-  __attribute__((format (printf, 1, 2)));
+  __attribute__((__format__ (__printf__, 1, 2)));
 extern void nbdkit_vdebug (const char *msg, va_list args);

 extern char *nbdkit_absolute_path (const char *path);
-- 
2.14.3




More information about the Libguestfs mailing list