summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <aega@med.umich.edu>2012-05-22 12:34:03 -0400
committerAlan Antonuk <aega@med.umich.edu>2012-05-24 15:46:50 -0400
commit990f932ea4c2aadecf554d7aa59045f862c566ff (patch)
tree5de9b6f235557b5963de761ab4f0f136c0f97808
parent970ccbc411c47c72920f1a6c94366ff8dd95a2fe (diff)
downloadrabbitmq-c-github-ask-990f932ea4c2aadecf554d7aa59045f862c566ff.tar.gz
Adding more strict compile Warning flags to gcc build
Added: -Wall -Wextra -pedantic -Wstrict-prototypes -Wcast-align -Wno-unused-function -fno-common -fvisibility=hidden The library compiles cleanly with the exception of the tools dir which has trouble with the initializer lists
-rw-r--r--CMakeLists.txt6
-rw-r--r--examples/utils.c2
-rw-r--r--librabbitmq/CMakeLists.txt2
-rw-r--r--tools/common.c5
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;