disable ACL_PRINTF when gcc's version < 4.4

This commit is contained in:
zhengshuxin 2017-07-11 09:04:20 +08:00
parent 3709d8c88b
commit 660f15554f
3 changed files with 4 additions and 8 deletions

View File

@ -54,10 +54,6 @@ ifeq ($(findstring g++, $(CC)), g++)
ifeq ($(GCC_VER), true) ifeq ($(GCC_VER), true)
CFLAGS += -Wno-implicit-fallthrough CFLAGS += -Wno-implicit-fallthrough
endif endif
GCC_VER:=$(shell [ $(GCC_MAJOR) -lt 4 -o \( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -ge 1 \) ] && echo true)
ifeq ($(GCC_VER), true)
CFLAGS += -DGCC_LOW
endif
endif endif
ifeq ($(AR),) ifeq ($(AR),)

View File

@ -14,8 +14,12 @@ namespace acl {
* >= size _WIN32 * >= size _WIN32
* 2) _WIN32 -1 * 2) _WIN32 -1
*/ */
#if defined(__GNUC__) && (__GNUC__ > 4 ||(__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
ACL_CPP_API int ACL_CPP_PRINTF(3, 4) safe_snprintf(char *buf, size_t size, ACL_CPP_API int ACL_CPP_PRINTF(3, 4) safe_snprintf(char *buf, size_t size,
const char *fmt, ...); const char *fmt, ...);
#else
ACL_CPP_API int safe_snprintf(char *buf, size_t size, const char *fmt, ...);
#endif
/** /**
* C snprintf API '\0' * C snprintf API '\0'

View File

@ -70,11 +70,7 @@ int safe_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
#else #else
#ifdef GCC_LOW
int safe_snprintf(char *buf, size_t size, const char *fmt, ...) throw()
#else
int safe_snprintf(char *buf, size_t size, const char *fmt, ...) int safe_snprintf(char *buf, size_t size, const char *fmt, ...)
#endif
{ {
va_list ap; va_list ap;