mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
disable ACL_PRINTF when gcc's version < 4.4
This commit is contained in:
parent
3709d8c88b
commit
660f15554f
@ -54,10 +54,6 @@ ifeq ($(findstring g++, $(CC)), g++)
|
||||
ifeq ($(GCC_VER), true)
|
||||
CFLAGS += -Wno-implicit-fallthrough
|
||||
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
|
||||
|
||||
ifeq ($(AR),)
|
||||
|
@ -14,8 +14,12 @@ namespace acl {
|
||||
* >= size;需要注意该返回值的含义与 _WIN32 下的不同
|
||||
* 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,
|
||||
const char *fmt, ...);
|
||||
#else
|
||||
ACL_CPP_API int safe_snprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 标准 C snprintf API 封装,可以保证结果缓冲区中的最后一个字节为 '\0'
|
||||
|
@ -70,11 +70,7 @@ int safe_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
|
||||
|
||||
#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, ...)
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user