diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | examples/utils.c | 2 | ||||
-rw-r--r-- | librabbitmq/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tools/common.c | 5 |
4 files changed, 12 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5247fc7..fa3819a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) set(VERSION "0.2") +if (MSVC) + set(CMAKE_C_FLAGS "/W4 /nologo ${CMAKE_C_FLAGS}") +else () + set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wstrict-prototypes -Wcast-align -Wno-unused-function -fno-common -fvisibility=hidden ${CMAKE_C_FLAGS}") +endif () + if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() diff --git a/examples/utils.c b/examples/utils.c index 871fc2a..b047c8d 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -133,7 +133,7 @@ void amqp_dump(void const *buffer, size_t len) { long count = 0; int numinrow = 0; int chs[16]; - int oldchs[16]; + int oldchs[16] = {0}; int showed_dots = 0; size_t i; diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt index 4cdc390..140c4b9 100644 --- a/librabbitmq/CMakeLists.txt +++ b/librabbitmq/CMakeLists.txt @@ -36,7 +36,7 @@ add_custom_command( SET(CONFIG_CONTENTS "#define VERSION \"${VERSION}\" #ifndef __cplusplus # define inline ${C_INLINE} -#endif // __cplusplus +#endif /* __cplusplus */ ") #prepare config.h diff --git a/tools/common.c b/tools/common.c index 2c248b9..70f3bca 100644 --- a/tools/common.c +++ b/tools/common.c @@ -34,6 +34,8 @@ #include "config.h" #endif +/* needed for asnprintf */ +#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -200,12 +202,13 @@ static void init_connection_info(struct amqp_connection_info *ci) "Parsing URL '%s'", amqp_url); if (amqp_server) { + char *colon; if (ci->host) die("both --server and --url options specify" " server host"); /* parse the server string into a hostname and a port */ - char *colon = strchr(amqp_server, ':'); + colon = strchr(amqp_server, ':'); if (colon) { char *port_end; size_t host_len; |