diff options
author | Sven Gothel <[email protected]> | 2020-05-23 11:43:50 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-05-23 11:43:50 +0200 |
commit | 6291468795a915d5fc7e2ec896711c849cded452 (patch) | |
tree | 6ffeed1e994fb88a22e68fad4668bfe426c54418 | |
parent | 92bd67617091712f7fba24f5dfd2e2ffc446b15b (diff) |
Examples: Set COMPILE_FLAGS "-Wall -Wextra -Werror"
-rw-r--r-- | examples/CMakeLists.txt | 30 | ||||
-rw-r--r-- | examples/tinyb/checkinit.cpp | 3 | ||||
-rw-r--r-- | examples/tinyb/esstinyb.cpp | 6 | ||||
-rw-r--r-- | examples/tinyb/notifications.cpp | 6 | ||||
-rw-r--r-- | examples/tinyb/uuid.cpp | 4 |
5 files changed, 35 insertions, 14 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6cadf26f..4f76b573 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,52 +12,62 @@ include_directories(${PROJECT_SOURCE_DIR}/api) add_executable (hellotinyb tinyb/hellotinyb.cpp) set_target_properties(hellotinyb PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (checkinit tinyb/checkinit.cpp) set_target_properties(checkinit PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (asynctinyb tinyb/asynctinyb.cpp) set_target_properties(asynctinyb PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (esstinyb tinyb/esstinyb.cpp) set_target_properties(esstinyb PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (notifications tinyb/notifications.cpp) set_target_properties(notifications PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (uuid tinyb/uuid.cpp) set_target_properties(uuid PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (list_mfg tinyb/list_mfg.cpp) set_target_properties(list_mfg PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (dbt_scanner00 direct_bt_scanner00/dbt_scanner00.cpp) set_target_properties(list_mfg PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (dbt_scanner01 direct_bt_scanner01/dbt_scanner01.cpp) set_target_properties(list_mfg PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") add_executable (dbt_scanner10 direct_bt_scanner10/dbt_scanner10.cpp) set_target_properties(list_mfg PROPERTIES - CXX_STANDARD 11) + CXX_STANDARD 11 + COMPILE_FLAGS "-Wall -Wextra -Werror") target_link_libraries (hellotinyb tinyb) target_link_libraries (checkinit tinyb) diff --git a/examples/tinyb/checkinit.cpp b/examples/tinyb/checkinit.cpp index fe4d47dd..e437ff4a 100644 --- a/examples/tinyb/checkinit.cpp +++ b/examples/tinyb/checkinit.cpp @@ -29,8 +29,11 @@ using namespace tinyb; int main(int argc, char **argv) { + (void)argc; + (void)argv; try { BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + (void)manager; } catch(const std::runtime_error& e) { std::cout << "Expected error: " << e.what() << std::endl; return 1; diff --git a/examples/tinyb/esstinyb.cpp b/examples/tinyb/esstinyb.cpp index 2155a5ed..1e9fc96c 100644 --- a/examples/tinyb/esstinyb.cpp +++ b/examples/tinyb/esstinyb.cpp @@ -82,6 +82,8 @@ static void wait_ctrl_c() void data_callback(BluetoothGattCharacteristic &c, std::vector<unsigned char> &data, void *userdata) { + (void)c; + (void)userdata; // unsigned char *data_c; unsigned int size = data.size(); if (size == 2) { @@ -97,6 +99,8 @@ void data_callback(BluetoothGattCharacteristic &c, std::vector<unsigned char> &d */ int main(int argc, char **argv) { + (void)argc; + (void)argv; BluetoothManager *manager = nullptr; try { manager = BluetoothManager::get_bluetooth_manager(); @@ -115,7 +119,7 @@ int main(int argc, char **argv) return 1; } std::cout << "Discovering BLE devices"; - int num_devices = 0; + size_t num_devices = 0; bool no_new_devices = false; std::vector<std::unique_ptr<BluetoothDevice>> list_devices; while (ess_device == NULL && !no_new_devices) { diff --git a/examples/tinyb/notifications.cpp b/examples/tinyb/notifications.cpp index e1850ffa..52290ffc 100644 --- a/examples/tinyb/notifications.cpp +++ b/examples/tinyb/notifications.cpp @@ -46,6 +46,8 @@ static float celsius_temp(uint16_t raw_temp) void data_callback(BluetoothGattCharacteristic &c, std::vector<unsigned char> &data, void *userdata) { + (void)c; + (void)userdata; /* Read temperature data and display it */ unsigned char *data_c; unsigned int size = data.size(); @@ -105,8 +107,8 @@ int main(int argc, char **argv) std::cout << "Device not found" << std::endl; return 1; } - sensor_tag->enable_connected_notifications([] (BluetoothDevice &d, bool connected, void *usedata) - { if (connected) std::cout << "Connected " << d.get_name() << std::endl; }, NULL); + sensor_tag->enable_connected_notifications([] (BluetoothDevice &d, bool connected, void *userdata) + { (void)userdata; if (connected) std::cout << "Connected " << d.get_name() << std::endl; }, NULL); if (sensor_tag != nullptr) { /* Connect to the device and get the list of services exposed by it */ diff --git a/examples/tinyb/uuid.cpp b/examples/tinyb/uuid.cpp index bef2f4cb..db5452bb 100644 --- a/examples/tinyb/uuid.cpp +++ b/examples/tinyb/uuid.cpp @@ -11,7 +11,9 @@ using namespace tinyb; int main(int argc, char **argv) { - + if( argc <= 2 ) { + exit(1); + } std::string uuid_string(argv[1]); std::cout << uuid_string << std::endl; |