Fixed some compiling errors on MaxOS.

This commit is contained in:
shuxin   zheng 2024-08-19 16:23:14 +08:00
parent f5478d54a4
commit 7729ab3fe5
15 changed files with 31 additions and 31 deletions

View File

@ -9,7 +9,7 @@ CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long \
-Wpointer-arith -Werror -Wshadow -pedantic -O2
-Wpointer-arith -Werror -Wshadow -O2
###########################################################
#Check system:

View File

@ -28,7 +28,7 @@ ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lpthread
RPATH = freebsd
endif

View File

@ -7,7 +7,7 @@ RANLIB = ranlib
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -pedantic -O2 \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long
###########################################################
@ -22,7 +22,7 @@ ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lcrypt -lpthread
endif

View File

@ -7,7 +7,7 @@ RANLIB = ranlib
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -pedantic -O2 \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long
###########################################################
@ -22,7 +22,7 @@ ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
endif
#Path for Linux

View File

@ -4,7 +4,7 @@ CC = $(MY_ENV_CC)
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -pedantic -O2 \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long
###########################################################
@ -30,7 +30,7 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lpthread
endif

View File

@ -7,7 +7,7 @@ RANLIB = ranlib
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -pedantic -O2 \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long \
-DUSE_TLS
@ -23,7 +23,7 @@ ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
endif
#Path for Linux

View File

@ -7,7 +7,7 @@ RANLIB = ranlib
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Wshadow -pedantic -O2 \
-Wpointer-arith -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long \
-DUSE_TLS
@ -24,7 +24,7 @@ ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
endif
#Path for Linux

View File

@ -43,7 +43,7 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD -pedantic
CFLAGS += -DFREEBSD
SYSLIB += -lcrypt
endif
@ -57,8 +57,6 @@ endif
#Path for Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
# CFLAGS += -DLINUX2 -pedantic
CFLAGS += -pedantic
SYSLIB += -lcrypt
endif
@ -84,7 +82,7 @@ ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
ifeq ($(findstring sun4u, $(UNIXNAME)), sun4u)
SYSLIB += -lsocket -lnsl -lrt
endif
CFLAGS += -DSUNOS5 -pedantic
CFLAGS += -DSUNOS5
SYSLIB += -lcrypt
endif

View File

@ -1,4 +1,4 @@
base_path = ../../..
include ../Makefile.in
CFLAGS += -Wno-write-strings -Wno-pedantic
CFLAGS += -Wno-write-strings
PROG = client

View File

@ -1,4 +1,4 @@
base_path = ../../..
include ../Makefile.in
CFLAGS += -Wno-write-strings -Wno-pedantic
CFLAGS += -Wno-write-strings
PROG = server

View File

@ -10,7 +10,7 @@ CFLAGS = -c -g -W -Wcast-qual -Wcast-align \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long \
-pedantic -Wall
-Wall
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
@ -24,14 +24,14 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lcrypt -lpthread
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
# CC += -arch x86_64 -arch arm64
CFLAGS += -D_REENTRANT -pedantic -DMACOSX
CFLAGS += -D_REENTRANT -DMACOSX
SYSLIB = -lpthread
endif

View File

@ -10,7 +10,7 @@ CFLAGS = -c -g -W -Wcast-qual -Wcast-align \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long \
-pedantic -Wall
-Wall
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
@ -24,14 +24,14 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lcrypt -lpthread
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
# CC += -arch x86_64 -arch arm64
CFLAGS += -D_REENTRANT -pedantic -DMACOSX
CFLAGS += -D_REENTRANT -DMACOSX
SYSLIB = -lpthread
endif

View File

@ -247,8 +247,8 @@ const char* MD5String(const char *s, const char *k, size_t k_len, char* buf, siz
MD5Final(digest, &context);
for (i = 0; i < 16; i++) {
sprintf(&(output1[2 * i]), "%02x", (unsigned char) digest[i]);
sprintf(&(output1[2 * i + 1]), "%02x", (unsigned char) (digest[i] << 4));
snprintf(&(output1[2 * i]), 1, "%02x", (unsigned char) digest[i]);
snprintf(&(output1[2 * i + 1]), 1, "%02x", (unsigned char) (digest[i] << 4));
}
ptr = buf;
@ -279,8 +279,8 @@ const char* MD5Key2String(const unsigned char *s, size_t s_len, char* buf, size_
memcpy(digest, s, 16);
for (i = 0; i < 16; i++) {
sprintf(&(output1[2 * i]), "%02x", (unsigned char) digest[i]);
sprintf(&(output1[2 * i + 1]), "%02x", (unsigned char) (digest[i] << 4));
snprintf(&(output1[2 * i]), 1, "%02x", (unsigned char) digest[i]);
snprintf(&(output1[2 * i + 1]), 1, "%02x", (unsigned char) (digest[i] << 4));
}
ptr = buf;

View File

@ -172,6 +172,7 @@ redis_thread::redis_thread(int tid, const char* addr, const char* passwd,
, oper_count_(oper_count)
, cmd_(cmd)
{
(void) stack_size_;
printf("addr: %s\r\n", addr_.c_str());
cluster_internal_ = new acl::redis_client_cluster;
cluster_ = cluster_internal_;
@ -191,6 +192,7 @@ redis_thread::redis_thread(int tid, acl::redis_client_cluster& cluster,
, cluster_(&cluster)
, cluster_internal_(NULL)
{
(void) stack_size_;
}
redis_thread::~redis_thread(void)

View File

@ -3,7 +3,7 @@ CC = gcc
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -pedantic -O2 \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long
###########################################################
@ -19,14 +19,14 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lpthread
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
# CC += -arch x86_64 -arch arm64
CFLAGS += -DMACOSX -D_REENTRANT -pedantic
CFLAGS += -DMACOSX -D_REENTRANT
SYSLIB = -lpthread
endif