fsaris / EspHome-AwoX-BLE-mesh-hub

Custom component for ESPhome that can act as a AwoX BLE mesh hub (Telink mesh)
54 stars 16 forks source link

Logger: Compile Warnings and Errors #62

Closed mykalanui closed 9 months ago

mykalanui commented 9 months ago

I have noticed several different warnings and errors when compiling with different log levels:

DEBUG (compiles with warnings):

...

|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/awox_mesh.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/device.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/device.cpp:6:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/group.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/group.h:6,
                 from src/esphome/components/awox_mesh/group.cpp:3:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/mesh_connection.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome/components/awox_mesh/awox_mesh.cpp:7:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/mesh_connection.cpp:5:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/core.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/gpio.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/preferences.o

...

Compiling .pioenvs/esphome-awox-mesh/app_trace/app_trace_util.o
Compiling .pioenvs/esphome-awox-mesh/app_trace/host_file_io.o
Compiling .pioenvs/esphome-awox-mesh/app_trace/gcov/gcov_rtio.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Archiving .pioenvs/esphome-awox-mesh/esp-idf/app_trace/libapp_trace.a
Compiling .pioenvs/esphome-awox-mesh/app_update/esp_ota_ops.o
Compiling .pioenvs/esphome-awox-mesh/app_update/esp_app_desc.o

...

VERBOSE (compile fails):

INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/awox-mesh-esp32.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-awox-mesh (board: esp32dev; framework: espidf; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40405.230623 (4.4.5) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Generating assembly for certificate bundle...
Dependency Graph
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/awox_mesh.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/device.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/device.cpp:6:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/group.o
In file included from src/esphome/components/awox_mesh/mesh_connection.h:8,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome/components/awox_mesh/awox_mesh.cpp:7:
src/esphome/components/awox_mesh/awox_mesh.cpp: In member function 'esphome::awox_mesh::Device* esphome::awox_mesh::AwoxMesh::get_device(int)':
src/esphome/core/log.h:86:102: error: expected primary-expression before ')' token
   esp_log_printf_(ESPHOME_LOG_LEVEL_VERBOSE, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                                      ^
src/esphome/core/log.h:154:28: note: in expansion of macro 'esph_log_v'
 #define ESP_LOGV(tag, ...) esph_log_v(tag, __VA_ARGS__)
                            ^~~~~~~~~~
src/esphome/components/awox_mesh/awox_mesh.cpp:373:5: note: in expansion of macro 'ESP_LOGV'
     ESP_LOGV(TAG, "Mesh_id: %d ignored, not part of allowed_mesh_ids", mesh_id, );
     ^~~~~~~~
src/esphome/components/awox_mesh/awox_mesh.cpp: In member function 'esphome::awox_mesh::Group* esphome::awox_mesh::AwoxMesh::get_group(int, esphome::awox_mesh::Device*)':
src/esphome/components/awox_mesh/awox_mesh.cpp:396:84: error: 'ptr' was not declared in this scope
     ESP_LOGV(TAG, "Found existing group_id: %d, Number of found mesh groups = %d", ptr->mesh_id,
                                                                                    ^~~
src/esphome/core/log.h:86:91: note: in definition of macro 'esph_log_v'
   esp_log_printf_(ESPHOME_LOG_LEVEL_VERBOSE, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                           ^~~~~~~~~~~
src/esphome/components/awox_mesh/awox_mesh.cpp:396:5: note: in expansion of macro 'ESP_LOGV'
     ESP_LOGV(TAG, "Found existing group_id: %d, Number of found mesh groups = %d", ptr->mesh_id,
     ^~~~~~~~
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/group.h:6,
                 from src/esphome/components/awox_mesh/group.cpp:3:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/mesh_connection.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome/components/awox_mesh/awox_mesh.cpp:7:
src/esphome/components/awox_mesh/helpers.h: At global scope:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
*** [.pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/awox_mesh.o] Error 1
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/mesh_connection.cpp:5:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
========================= [FAILED] Took 64.37 seconds =========================

Logger Uncommented (compiles with warnings):


...

|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/awox_mesh.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/device.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/device.cpp:6:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/group.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/group.h:6,
                 from src/esphome/components/awox_mesh/group.cpp:3:
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/awox_mesh/mesh_connection.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome/components/awox_mesh/awox_mesh.cpp:7:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/mesh_connection.cpp:5:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/core.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/gpio.o
Compiling .pioenvs/esphome-awox-mesh/src/esphome/components/esp32/preferences.o

...

Compiling .pioenvs/esphome-awox-mesh/app_trace/gcov/gcov_rtio.o
Archiving .pioenvs/esphome-awox-mesh/esp-idf/app_trace/libapp_trace.a
Compiling .pioenvs/esphome-awox-mesh/app_update/esp_ota_ops.o
In file included from src/esphome/components/awox_mesh/device.h:8,
                 from src/esphome/components/awox_mesh/mesh_connection.h:13,
                 from src/esphome/components/awox_mesh/awox_mesh.h:15,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/components/awox_mesh/helpers.h:17:20: warning: 'std::__cxx11::string esphome::awox_mesh::int_as_hex_string(unsigned char, unsigned char, unsigned char)' defined but not used [-Wunused-function]
 static std::string int_as_hex_string(unsigned char hex1, unsigned char hex2, unsigned char hex3) {
                    ^~~~~~~~~~~~~~~~~
src/esphome/components/awox_mesh/helpers.h:9:20: warning: 'std::__cxx11::string esphome::awox_mesh::string_as_binary_string(std::__cxx11::string)' defined but not used [-Wunused-function]
 static std::string string_as_binary_string(std::string words) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/esphome-awox-mesh/app_update/esp_app_desc.o
Archiving .pioenvs/esphome-awox-mesh/esp-idf/app_update/libapp_update.a
Compiling .pioenvs/esphome-awox-mesh/bootloader_support/src/bootloader_common.o

...
mykalanui commented 9 months ago

could this in any way be related to my reboot-loop issues mentioned in #56 ?

fsaris commented 9 months ago

The warnings aren't a issue, it's only complaining about unused code.

Are you using the main or dev branch?

fsaris commented 9 months ago

ah, in the verbose version there is indeed a compiler error.

fsaris commented 9 months ago

@mykalanui tnx for pointing this out, fix in new version. Regarding #56 this will only have a impact there if you used VERBOSE logging.