diff --git a/CMakeLists.txt b/CMakeLists.txt index af2fced..fe0df2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable(controller main.c) option(WIRING_PI_DEBUG "Use WiringPi Debugging Tool (0=off, 1=silent, 2=LOG_DEBUG) (0)" OFF) option(LOG_LEVEL "Set logging level (5=trace, 4=debug, 3=info, 2=warn, 1=error, 0=fatal) (3)" OFF) -SET(CMAKE_C_FLAGS "-Wall -Wextra -lwiringPi -lwiringPiDev -luuid -llmdb -g") +SET(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wpedantic -lwiringPi -lwiringPiDev -luuid -llmdb -g") string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE) add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}") diff --git a/models/controller.c b/models/controller.c index 77ffff9..b14a2a3 100644 --- a/models/controller.c +++ b/models/controller.c @@ -60,11 +60,11 @@ controller_debug(controller_t *controller) } char uuid_str[37]; uuid_unparse(controller->id, uuid_str); - LOG_DEBUG("(1/5) %s @ %p", uuid_str, controller); + LOG_DEBUG("(1/5) %s @ %p", uuid_str, (void*)controller); LOG_DEBUG("(2/5) name: %s", controller->name); LOG_DEBUG("(3/5) command_port: %5d discovery_port: %5d", controller->command_port, controller->discovery_port); LOG_DEBUG("(4/5) relay count: %3d", controller->relay_count); - LOG_DEBUG("(5/5) relays @ %p:", controller->relays); + LOG_DEBUG("(5/5) relays @ %p:", (void*)controller->relays); for(uint8_t i = 0; i < controller->relay_count; ++i) { relay_debug(controller->relays[i]); diff --git a/models/relay.c b/models/relay.c index 87ee257..48e59c0 100644 --- a/models/relay.c +++ b/models/relay.c @@ -65,7 +65,7 @@ relay_debug(relay_t *relay) LOG_DEBUG("relay is NULL"); return; } - LOG_DEBUG("(1/3) %d @ %p", relay->number, relay); + LOG_DEBUG("(1/3) %d @ %p", relay->number, (void*)relay); LOG_DEBUG("(2/3) name: %s", relay->name); LOG_DEBUG("(3/3) schedule:"); schedule_debug(relay->schedule); diff --git a/models/relay_load.c b/models/relay_load.c index 1d4a76d..141f7c2 100644 --- a/models/relay_load.c +++ b/models/relay_load.c @@ -14,8 +14,8 @@ relay_load_single(MDB_txn *mdb_txn, MDB_dbi mdb_dbi, db_key_relay_e key_relay, u size_t key_size = sizeof(db_key_relay_e) + sizeof(uint8_t); void *key_data = malloc(key_size); - memmove(key_data, &key_relay, sizeof(db_key_relay_e)); - memmove(key_data + sizeof(db_key_relay_e), &num, sizeof(uint8_t)); + memmove((uint8_t*)key_data, &key_relay, sizeof(db_key_relay_e)); + memmove((uint8_t*)key_data + sizeof(db_key_relay_e), &num, sizeof(uint8_t)); MDB_val key; key.mv_size = key_size; diff --git a/models/relay_save.c b/models/relay_save.c index e932940..ff91c9e 100644 --- a/models/relay_save.c +++ b/models/relay_save.c @@ -14,8 +14,8 @@ relay_save_single(MDB_txn *mdb_txn, MDB_dbi mdb_dbi, db_key_relay_e key_relay, u size_t key_size = sizeof(db_key_relay_e) + sizeof(uint8_t); void *key_data = malloc(key_size); - memmove(key_data, &key_relay, sizeof(db_key_relay_e)); - memmove(key_data + sizeof(db_key_relay_e), &num, sizeof(uint8_t)); + memmove((uint8_t*)key_data, &key_relay, sizeof(db_key_relay_e)); + memmove((uint8_t*)key_data + sizeof(db_key_relay_e), &num, sizeof(uint8_t)); MDB_val key; key.mv_size = key_size; diff --git a/models/schedule.c b/models/schedule.c index ee37df6..901e2ef 100644 --- a/models/schedule.c +++ b/models/schedule.c @@ -66,7 +66,7 @@ schedule_debug(schedule_t *schedule) } char uuid_str[37]; uuid_unparse(schedule->id, uuid_str); - LOG_DEBUG("(1/3) %s @ %p", uuid_str, schedule); + LOG_DEBUG("(1/3) %s @ %p", uuid_str, (void*)schedule); LOG_DEBUG("(2/3) period count: %3d", schedule->length); // one block: "HH:MM-HH:MM, " --> size: 13 (14 with '\0') diff --git a/vendor/confini.c b/vendor/confini.c index 63ca3c7..25353a7 100644 --- a/vendor/confini.c +++ b/vendor/confini.c @@ -1959,6 +1959,7 @@ static size_t further_cuts (char * const srcstr, const IniFormat format) { follow (switch case fallthrough). */ + __attribute__((fallthrough)); case _LIBCONFINI_VT_: case _LIBCONFINI_FF_: @@ -2527,6 +2528,7 @@ int strip_ini_cache ( (switch case fallthrough). */ + __attribute__((fallthrough)); case _LIBCONFINI_SC_INT_MARKER_: @@ -2819,7 +2821,7 @@ int load_ini_file ( } - if (file_size > SIZE_MAX) { + if ((size_t) file_size > SIZE_MAX) { return CONFINI_EFBIG; @@ -2835,7 +2837,7 @@ int load_ini_file ( rewind(ini_file); - if (fread(cache, 1, (size_t) file_size, ini_file) < file_size) { + if (fread(cache, 1, (size_t) file_size, ini_file) < (size_t) file_size) { free(cache); return CONFINI_EIO; @@ -2911,7 +2913,7 @@ int load_ini_path ( } - if (file_size > SIZE_MAX) { + if ((size_t) file_size > SIZE_MAX) { return CONFINI_EFBIG; @@ -2927,7 +2929,7 @@ int load_ini_path ( rewind(ini_file); - if (fread(cache, 1, (size_t) file_size, ini_file) < file_size) { + if (fread(cache, 1, (size_t) file_size, ini_file) < (size_t) file_size) { free(cache); return CONFINI_EIO;