Skip to content

Commit

Permalink
fix(common): removed Wno-format flag and fixed formatting warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
suren-gabrielyan-espressif committed Sep 8, 2023
1 parent 13b29c2 commit aeec2f4
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 40 deletions.
1 change: 0 additions & 1 deletion components/asio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ idf_component_register(SRCS ${asio_sources}
INCLUDE_DIRS "asio/asio/include" "port/include"
PRIV_INCLUDE_DIRS ${asio_priv_includes}
REQUIRES lwip)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

if(CONFIG_ASIO_SSL_SUPPORT)
if(CONFIG_ASIO_USE_ESP_WOLFSSL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ idf_component_register(SRCS "modem_console_main.cpp"
"ping_handle.c"
REQUIRES console esp_http_client nvs_flash
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ extern "C" void app_main(void)
ESP_LOGI(TAG, "Waiting for USB device connection...");
auto dte = create_usb_dte(&dte_config);
dte->set_error_cb([&](terminal_error err) {
ESP_LOGI(TAG, "error handler %d", err);
ESP_LOGI(TAG, "error handler %d", (int)err);
if (err == terminal_error::DEVICE_GONE) {
exit_signal.set(1);
}
Expand Down Expand Up @@ -482,7 +482,7 @@ extern "C" void app_main(void)
// wait for exit
exit_signal.wait_any(1, UINT32_MAX);
s_repl->del(s_repl);
ESP_LOGI(TAG, "Exiting...%d", esp_get_free_heap_size());
ESP_LOGI(TAG, "Exiting...%" PRIu32, esp_get_free_heap_size());
#if defined(CONFIG_EXAMPLE_SERIAL_CONFIG_USB)
// USB example runs in a loop to demonstrate hot-plugging and sudden disconnection features.
} // while (1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
Expand Down Expand Up @@ -28,7 +28,7 @@ static void cmd_ping_on_ping_success(esp_ping_handle_t hdl, void *args)
esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr));
esp_ping_get_profile(hdl, ESP_PING_PROF_SIZE, &recv_len, sizeof(recv_len));
esp_ping_get_profile(hdl, ESP_PING_PROF_TIMEGAP, &elapsed_time, sizeof(elapsed_time));
ESP_LOGI(TAG, "%d bytes from %s icmp_seq=%d ttl=%d time=%d ms\n",
ESP_LOGI(TAG, "%" PRIu32 " bytes from %s icmp_seq=%d ttl=%d time=%" PRIu32 " ms\n",
recv_len, inet_ntoa(target_addr.u_addr.ip4), seqno, ttl, elapsed_time);
}

Expand Down Expand Up @@ -57,7 +57,7 @@ static void cmd_ping_on_ping_end(esp_ping_handle_t hdl, void *args)
} else {
ESP_LOGI(TAG, "\n--- %s ping statistics ---\n", inet6_ntoa(*ip_2_ip6(&target_addr)));
}
ESP_LOGI(TAG, "%d packets transmitted, %d received, %d%% packet loss, time %dms\n",
ESP_LOGI(TAG, "%" PRIu32 " packets transmitted, %" PRIu32 " received, %" PRIu32 " packet loss, time %" PRIu32 "ms\n",
transmitted, received, loss, total_time_ms);
// delete the ping sessions, so that we clean up all resources and can create a new ping session
// we don't have to call delete function in the callback, instead we can call delete function from other tasks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

idf_component_register(SRCS "modem_psm.c"
INCLUDE_DIRS ".")
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ idf_component_register(SRCS "modem_client.cpp"
"tcp_transport_at.cpp"
"${device_srcs}"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const int GOT_DATA_BIT = BIT2;

static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data)
{
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRId32, base, event_id);
esp_mqtt_event_handle_t event = (esp_mqtt_event_handle_t)event_data;
esp_mqtt_client_handle_t client = event->client;
int msg_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ bool DCE::at_to_sock()
{
uint64_t data;
read(data_ready_fd, &data, sizeof(data));
ESP_LOGD(TAG, "select read: modem data available %x", data);
ESP_LOGD(TAG, "select read: modem data available %" PRIu64, data);
if (!signal.wait(IDLE, 1000)) {
ESP_LOGE(TAG, "Failed to get idle");
close_sock();
return false;
}
if (state != status::IDLE) {
ESP_LOGE(TAG, "Unexpected state %d", state);
ESP_LOGE(TAG, "Unexpected state %d", static_cast<int>(state));
close_sock();
return false;
}
Expand All @@ -145,7 +145,7 @@ bool DCE::sock_to_at()
return false;
}
if (state != status::IDLE) {
ESP_LOGE(TAG, "Unexpected state %d", state);
ESP_LOGE(TAG, "Unexpected state %d", static_cast<int>(state));
close_sock();
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
idf_component_register(SRCS "pppos_client_main.c"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if ((xEventGroupGetBits(event_group) & USB_DISCONNECTED_BIT) == USB_DISCONNECTED

static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data)
{
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIu32, base, event_id);
esp_mqtt_event_handle_t event = event_data;
esp_mqtt_client_handle_t client = event->client;
int msg_id;
Expand Down Expand Up @@ -102,7 +102,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
static void on_ppp_changed(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ESP_LOGI(TAG, "PPP state changed event %d", event_id);
ESP_LOGI(TAG, "PPP state changed event %" PRIu32, event_id);
if (event_id == NETIF_PPP_ERRORUSER) {
/* User interrupted event from esp-netif */
esp_netif_t *netif = event_data;
Expand All @@ -114,7 +114,7 @@ static void on_ppp_changed(void *arg, esp_event_base_t event_base,
static void on_ip_event(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ESP_LOGD(TAG, "IP event! %d", event_id);
ESP_LOGD(TAG, "IP event! %" PRIu32, event_id);
if (event_id == IP_EVENT_PPP_GOT_IP) {
esp_netif_dns_info_t dns_info;

Expand Down
2 changes: 0 additions & 2 deletions components/esp_modem/test/target/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ set_target_properties(${COMPONENT_LIB} PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)

target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
6 changes: 3 additions & 3 deletions components/esp_modem/test/target/main/pppd_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
Expand Down Expand Up @@ -27,7 +27,7 @@ static void on_modem_event(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
if (event_base == IP_EVENT) {
ESP_LOGD(TAG, "IP event! %d", event_id);
ESP_LOGD(TAG, "IP event! %" PRId32, event_id);
if (event_id == IP_EVENT_PPP_GOT_IP) {
esp_netif_dns_info_t dns_info;

Expand Down Expand Up @@ -61,7 +61,7 @@ static void on_modem_event(void *arg, esp_event_base_t event_base,
static void on_ppp_changed(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ESP_LOGI(TAG, "PPP state changed event %d", event_id);
ESP_LOGI(TAG, "PPP state changed event %" PRId32, event_id);
if (event_id == NETIF_PPP_ERRORUSER) {
/* User interrupted event from esp-netif */
esp_netif_t *netif = static_cast<esp_netif_t *>(event_data);
Expand Down
2 changes: 0 additions & 2 deletions components/esp_mqtt_cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ idf_component_register(SRCS "esp_mqtt_cxx.cpp"
INCLUDE_DIRS "include"
REQUIRES mqtt
)

target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
2 changes: 1 addition & 1 deletion components/esp_mqtt_cxx/esp_mqtt_cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Client::Client(esp_mqtt_client_config_t const &config) : handler(esp_mqtt_clien

void Client::mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) noexcept
{
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIu32, base, event_id);
auto *event = static_cast<esp_mqtt_event_t *>(event_data);
auto &client = *static_cast<Client *>(handler_args);
switch (event->event_id) {
Expand Down
1 change: 0 additions & 1 deletion components/esp_mqtt_cxx/examples/ssl/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
idf_component_register(SRCS "mqtt_ssl_example.cpp"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace mqtt = idf::mqtt;
extern "C" void app_main(void)
{
ESP_LOGI(TAG, "[APP] Startup..");
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());

esp_log_level_set("*", ESP_LOG_INFO);
Expand Down
1 change: 0 additions & 1 deletion components/esp_mqtt_cxx/examples/tcp/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
idf_component_register(SRCS "mqtt_tcp_example.cpp"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MyClient final : public mqtt::Client {
extern "C" void app_main(void)
{
ESP_LOGI(TAG, "[APP] Startup..");
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());

esp_log_level_set("*", ESP_LOG_INFO);
Expand Down
1 change: 0 additions & 1 deletion components/mdns/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ idf_component_register(
PRIV_INCLUDE_DIRS "private_include"
REQUIRES ${dependencies}
PRIV_REQUIRES ${private_dependencies})
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

if(${target} STREQUAL "linux")
target_link_libraries(${COMPONENT_LIB} PRIVATE "-lbsd")
Expand Down
1 change: 0 additions & 1 deletion components/mdns/examples/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
idf_component_register(SRCS "mdns_example_main.c"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
2 changes: 1 addition & 1 deletion components/mdns/examples/main/mdns_example_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void mdns_print_results(mdns_result_t *results)
int i = 1, t;
while (r) {
if (r->esp_netif) {
printf("%d: Interface: %s, Type: %s, TTL: %u\n", i++, esp_netif_get_ifkey(r->esp_netif),
printf("%d: Interface: %s, Type: %s, TTL: %" PRIu32 "\n", i++, esp_netif_get_ifkey(r->esp_netif),
ip_protocol_str[r->ip_protocol], r->ttl);
}
if (r->instance_name) {
Expand Down
8 changes: 4 additions & 4 deletions components/mdns/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ static void _mdns_dispatch_tx_packet(mdns_tx_packet_t *p)
_mdns_set_u16(packet, MDNS_HEAD_ADDITIONAL_OFFSET, count);

#ifdef MDNS_ENABLE_DEBUG
_mdns_dbg_printf("\nTX[%u][%u]: ", p->tcpip_if, p->ip_protocol);
_mdns_dbg_printf("\nTX[%lu][%lu]: ", (unsigned long)p->tcpip_if, (unsigned long)p->ip_protocol);
if (p->dst.type == ESP_IPADDR_TYPE_V4) {
_mdns_dbg_printf("To: " IPSTR ":%u, ", IP2STR(&p->dst.u_addr.ip4), p->port);
} else {
Expand Down Expand Up @@ -3492,7 +3492,7 @@ void mdns_parse_packet(mdns_rx_packet_t *packet)
mdns_search_once_t *search_result = NULL;

#ifdef MDNS_ENABLE_DEBUG
_mdns_dbg_printf("\nRX[%u][%u]: ", packet->tcpip_if, (uint32_t)packet->ip_protocol);
_mdns_dbg_printf("\nRX[%lu][%lu]: ", (unsigned long)packet->tcpip_if, (unsigned long)packet->ip_protocol);
if (packet->src.type == ESP_IPADDR_TYPE_V4) {
_mdns_dbg_printf("From: " IPSTR ":%u, To: " IPSTR ", ", IP2STR(&packet->src.u_addr.ip4), packet->src_port, IP2STR(&packet->dest.u_addr.ip4));
} else {
Expand Down Expand Up @@ -6537,7 +6537,7 @@ void mdns_debug_packet(const uint8_t *data, size_t len)
mdns_name_t *name = &n;
memset(name, 0, sizeof(mdns_name_t));

_mdns_dbg_printf("Packet[%u]: ", t);
_mdns_dbg_printf("Packet[%" PRIu32 "]: ", t);

header.id = _mdns_read_u16(data, MDNS_HEAD_ID_OFFSET);
header.flags = _mdns_read_u16(data, MDNS_HEAD_FLAGS_OFFSET);
Expand Down Expand Up @@ -6675,7 +6675,7 @@ void mdns_debug_packet(const uint8_t *data, size_t len)
if (flush) {
_mdns_dbg_printf("FLUSH ");
}
_mdns_dbg_printf("%u ", ttl);
_mdns_dbg_printf("%" PRIu32, ttl);
_mdns_dbg_printf("[%u] ", data_len);
if (type == MDNS_TYPE_PTR) {
if (!_mdns_parse_fqdn(data, data_ptr, name, len)) {
Expand Down
2 changes: 1 addition & 1 deletion components/mdns/mdns_networking_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static bool create_pcb(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)

esp_err_t _mdns_pcb_init(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{
ESP_LOGI(TAG, "_mdns_pcb_init(tcpip_if=%d, ip_protocol=%d)", tcpip_if, ip_protocol);
ESP_LOGI(TAG, "_mdns_pcb_init(tcpip_if=%lu, ip_protocol=%lu)", (unsigned long)tcpip_if, (unsigned long)ip_protocol);
if (!create_pcb(tcpip_if, ip_protocol)) {
return ESP_FAIL;
}
Expand Down
2 changes: 1 addition & 1 deletion components/mdns/private_include/mdns_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
#define PCB_STATE_IS_RUNNING(s) (s->state == PCB_RUNNING)

#ifndef HOOK_MALLOC_FAILED
#define HOOK_MALLOC_FAILED ESP_LOGE(TAG, "Cannot allocate memory (line: %d, free heap: %d bytes)", __LINE__, esp_get_free_heap_size());
#define HOOK_MALLOC_FAILED ESP_LOGE(TAG, "Cannot allocate memory (line: %d, free heap: %" PRIu32 " bytes)", __LINE__, esp_get_free_heap_size());
#endif

typedef size_t mdns_if_t;
Expand Down
1 change: 0 additions & 1 deletion components/mdns/tests/test_apps/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
idf_component_register(SRCS "main.c" "mdns_test.c"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
2 changes: 1 addition & 1 deletion components/mdns/tests/test_apps/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void initialise_mdns(void)

void app_main(void)
{
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());

ESP_ERROR_CHECK(nvs_flash_init());
Expand Down

0 comments on commit aeec2f4

Please sign in to comment.