summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorChristian Blichmann <cblichmann@google.com>2022-10-20 12:07:38 +0200
committerPeter LaFosse <peter@vector35.com>2022-11-10 16:51:49 -0500
commitc47424d39b9b2f782adc1abf2e2e9090fc2ec4e6 (patch)
treeecfdfb4fdf01d6188911a5f1188e5c542beb2ebf /binaryninjaapi.h
parentfc3a056c61845fa48dacbde967ddb5cc98c06392 (diff)
Introduce a macro to implement `printf` attribute
This lets us remove a lot of `#ifdef __GNUC__` in function declarations, which makes them more readable.
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h28
1 files changed, 7 insertions, 21 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 0488803e..a6a98da2 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -516,9 +516,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 2, 3)))
-#endif
+ BN_PRINTF_ATTRIBUTE(2, 3)
void Log(BNLogLevel level, const char* fmt, ...);
/*! LogTrace only writes text to the error console if the console is set to log level: DebugLog
@@ -529,9 +527,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogTrace(const char* fmt, ...);
@@ -543,9 +539,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogDebug(const char* fmt, ...);
/*! LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
@@ -556,9 +550,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogInfo(const char* fmt, ...);
/*! LogWarn writes text to the error console including a warning icon,
@@ -569,9 +561,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogWarn(const char* fmt, ...);
/*! LogError writes text to the error console and pops up the error console. Additionall,
@@ -582,9 +572,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogError(const char* fmt, ...);
/*! LogAlert pops up a message box displaying the alert message and logs to the error console.
@@ -595,9 +583,7 @@ namespace BinaryNinja {
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
*/
-#ifdef __GNUC__
- __attribute__((format(printf, 1, 2)))
-#endif
+ BN_PRINTF_ATTRIBUTE(1, 2)
void LogAlert(const char* fmt, ...);
/*! Redirects the minimum level passed to standard out