You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to compile my own code with the -Wsign-conversion cflag. Unfortunately, some of ESP-IDF headers are not compatible with this option and generate some warnings.
components/freertos/include/freertos/portable.h:
(maybe the right fix is changing the return type of cpu_hal_get_core_id ? Internally, cpu_hal_get_core_id uses an uint32_t.)
@@ -202,7 +202,7 @@ BaseType_t xPortInterruptedFromISRContext(void);
/* Multi-core: get current core ID */
static inline uint32_t IRAM_ATTR xPortGetCoreID(void) {
- return cpu_hal_get_core_id();
+ return (uint32_t) cpu_hal_get_core_id();
}
/* Get tick rate per second */
components/xtensa/include/xtensa/xtruntime.h:
@@ -158,12 +158,12 @@ extern unsigned int _xtos_ints_on( unsigned int mask );
/* Newer functions to enable/disable the specified interrupt. */
static inline void _xtos_interrupt_enable(unsigned int intnum)
{
- _xtos_ints_on(1 << intnum);
+ _xtos_ints_on(1U << intnum);
}
static inline void _xtos_interrupt_disable(unsigned int intnum)
{
- _xtos_ints_off(1 << intnum);
+ _xtos_ints_off(1U << intnum);
}
extern unsigned _xtos_set_intlevel( int intlevel );
Could you fix these? Thank you!
Code to reproduce this issue
Patch on the SDK examples to include the headers mentioned above.
Add this after idf_component_register(): target_compile_options(${COMPONENT_LIB} PRIVATE "-Wsign-conversion")
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Some SDK headers not compatible with -Wsign-conversion
Some SDK headers not compatible with -Wsign-conversion (IDFGH-2901)
Mar 17, 2020
Environment
Problem Description
I would like to compile my own code with the
-Wsign-conversion
cflag. Unfortunately, some of ESP-IDF headers are not compatible with this option and generate some warnings.components/esp_http_server/include/esp_http_server.h
:components/freertos/include/freertos/portable.h
:(maybe the right fix is changing the return type of
cpu_hal_get_core_id
? Internally,cpu_hal_get_core_id
uses anuint32_t
.)components/xtensa/include/xtensa/xtruntime.h
:Could you fix these? Thank you!
Code to reproduce this issue
idf_component_register()
:target_compile_options(${COMPONENT_LIB} PRIVATE "-Wsign-conversion")
The text was updated successfully, but these errors were encountered: