Merge pull request #92 from nickbroon/Werror

Use -Werror to fail the build on compiler warnings
master
Oliver Gasser 2018-01-17 15:19:02 +01:00 committed by GitHub
commit 37c14dd16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View File

@ -145,4 +145,4 @@ matrix:
before_install:
- eval "${MATRIX_EVAL}"
script: cmake -DCMAKE_INSTALL_PREFIX=/tmp -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUPPORT_JOURNALD=ON -DSUPPORT_DTLS="$DTLS" -DSUPPORT_ZMQ="$ZMQ" . && make && make test && make install
script: cmake -DCMAKE_INSTALL_PREFIX=/tmp -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUPPORT_JOURNALD=ON -DSUPPORT_DTLS="$DTLS" -DSUPPORT_ZMQ="$ZMQ" . && make -k && make test && make install

View File

@ -26,13 +26,12 @@ PROJECT(VERMONT)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# TODO: Once all warnings are fixed add -Werror to both of these
# TODO: Bonus: Remove -Wno-unused-parameter and fix all code as this one gernerates hundreds of warnings
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Wall -pedantic -Wextra -Wno-unused-parameter"
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Werror -Wall -pedantic -Wextra -Wno-unused-parameter"
CACHE STRING
"Recommended C Flags"
FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -pedantic -Wextra -Wno-unused-parameter"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Werror -Wall -pedantic -Wextra -Wno-unused-parameter"
CACHE STRING
"Recommended C++ Flags"
FORCE)

View File

@ -42,6 +42,7 @@
#include "ipfixlolib.h"
#include "ipfixlolib_private.h"
#include "encoding.h"
#include "common/defs.h" /* __FALLTHROUGH__ */
#include "common/msg.h"
#include <netinet/in.h>
#include <sys/types.h>
@ -1818,10 +1819,10 @@ static int ipfix_send_templates(ipfix_exporter* exporter)
if ((time_now - col->last_reconnect_attempt_time) <= exporter->sctp_reconnect_timer) {
break; // Not time to reconnect
}
// fall through
__FALLTHROUGH__;
case C_NEW:
sctp_reconnect(col);
// fall through
__FALLTHROUGH__;
case C_CONNECTED:
if (exporter->sctp_template_sendbuffer->committed_data_length > 0) {
// update the sendbuffer header, as we must set the export time & sequence number!
@ -2426,11 +2427,11 @@ int ipfix_start_template (ipfix_exporter *exporter, uint16_t template_id, uint1
case T_SENT:
// create a withdrawal message first
ipfix_remove_template(exporter, exporter->template_arr[found_index].template_id);
/* fall through */
__FALLTHROUGH__;
case T_WITHDRAWN:
// send withdrawal messages
ipfix_send_templates(exporter);
/* fall through */
__FALLTHROUGH__;
case T_COMMITED:
case T_UNCLEAN:
case T_TOBEDELETED:

View File

@ -1,5 +1,6 @@
#include <fcntl.h>
#include "common/defs.h" /* __FALLTHROUGH__ */
#include "common/msg.h"
#include "common/openssl/OpenSSL.h"
#include "ipfixlolib_private.h"
@ -540,7 +541,7 @@ static int dtls_send_helper( ipfix_dtls_connection *con,
if (errno == EMSGSIZE) {
return -3;
}
/* fall through */
__FALLTHROUGH__;
default:
msg_openssl_return_code(MSG_ERROR,"SSL_write()",len,error);
dtls_fail_connection(con);