[sysprof: 30/63] libsysprof-capture: Use SYSPROF_PRINTF rather than G_GNUC_PRINTF



commit 175c53aed8a6aa6590b9388406fab359e0ae8f76
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Jul 2 10:56:02 2020 +0100

    libsysprof-capture: Use SYSPROF_PRINTF rather than G_GNUC_PRINTF
    
    It does the same thing for modern compilers.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #40

 src/libsysprof-capture/sysprof-collector.h | 2 +-
 src/libsysprof-capture/sysprof-macros.h    | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/sysprof-collector.h b/src/libsysprof-capture/sysprof-collector.h
index f59ca92..b91a5a7 100644
--- a/src/libsysprof-capture/sysprof-collector.h
+++ b/src/libsysprof-capture/sysprof-collector.h
@@ -85,6 +85,6 @@ SYSPROF_AVAILABLE_IN_3_38
 void sysprof_collector_log_printf (int                  severity,
                                    const char          *domain,
                                    const char          *format,
-                                   ...) G_GNUC_PRINTF (3, 4);
+                                   ...) SYSPROF_PRINTF (3, 4);
 
 SYSPROF_END_DECLS
diff --git a/src/libsysprof-capture/sysprof-macros.h b/src/libsysprof-capture/sysprof-macros.h
index a7bcc04..1faa002 100644
--- a/src/libsysprof-capture/sysprof-macros.h
+++ b/src/libsysprof-capture/sysprof-macros.h
@@ -80,3 +80,9 @@
 #define SYSPROF_LIKELY(expr) (expr)
 #define SYSPROF_UNLIKELY(expr) (expr)
 #endif
+
+#if defined(__GNUC__)
+#define SYSPROF_PRINTF(format_idx, arg_idx) __attribute__((format(printf, format_idx, arg_idx)))
+#else
+#define SYSPROF_PRINTF(format_idx, arg_idx)
+#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]