diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/cbasetypes.h | 15 | ||||
-rw-r--r-- | src/common/sql.c | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 6843ce486..3675d8fa4 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -295,6 +295,21 @@ typedef uintptr_t uintptr; #define analyzer_noreturn #endif +// gcc version (if any) - borrowed from Mana Plus +#ifdef __GNUC__ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#else +#define GCC_VERSION 0 +#endif + +// Pragma macro only enabled on gcc >= 4.5 or clang - borrowed from Mana Plus +#if defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500) +#define PRAGMA_GCC45(str) _Pragma(#str) +#else // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500) +#define PRAGMA_GCC45(str) +#endif // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500) // boolean types for C #if !defined(_MSC_VER) || _MSC_VER >= 1800 diff --git a/src/common/sql.c b/src/common/sql.c index 65960d8ea..1eae1b29b 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -653,8 +653,8 @@ int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_ if (idx >= self->max_params) return SQL_SUCCESS; // out of range - ignore -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wcast-qual" +PRAGMA_GCC45(GCC diagnostic push) +PRAGMA_GCC45(GCC diagnostic ignored "-Wcast-qual") /* * MySQL uses the same struct with a non-const buffer for both * parameters (input) and columns (output). @@ -662,7 +662,7 @@ int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_ * dropping a const qualifier here. */ return Sql_P_BindSqlDataType(self->params+idx, buffer_type, (void *)buffer, buffer_len, NULL, NULL); -#pragma GCC diagnostic pop +PRAGMA_GCC45(GCC diagnostic pop) } /// Executes the prepared statement. |