-
Notifications
You must be signed in to change notification settings - Fork 2.1k
"Minor" compiling issues found by clang #7875
Copy link
Copy link
Closed
Labels
Area: driversArea: Device driversArea: Device driversArea: testsArea: tests and testing frameworkArea: tests and testing frameworkImpact: minorThe PR is small in size and might only require a quick look of a knowledgeable reviewerThe PR is small in size and might only require a quick look of a knowledgeable reviewerState: staleState: The issue / PR has no activity for >185 daysState: The issue / PR has no activity for >185 daysType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
Here you have a list of compiling issues I found using clang (with its respective PRs):
- tests_driver_adcxx1c fixed in tests/driver_adcxx1c: fix warning unused argument #7856.
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_adcxx1c/main.c:31:28: error: unused parameter 'arg' [-Werror,-Wunused-parameter]
static void alert_cb(void *arg)
^
1 error generated.- tests_driver_at86rf2xx fixed in tests/driver_at86rf2xx: fix var lengths and unused vars #7860
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_at86rf2xx/addr.c:23:23: error: comparison of integers of different signs: 'int' and 'size_t'
(aka 'unsigned long') [-Werror,-Wsign-compare]
for (int i = 0; i < addr_len; i++) {
~ ^ ~~~~~~~~
1 error generated.And some more which came after this one was solved.
- tests_driver_enc28j60 fixed in drivers/enc28j60/enc28j60.c: fix counter var length #7857
/Users/facosta/git/RIOT-OS/RIOT/drivers/enc28j60/enc28j60.c:259:23: error: comparison of integers of different signs: 'int' and
'unsigned int' [-Werror,-Wsign-compare]
for (int i = 0; i < count; i++) {
~ ^ ~~~~~
/Users/facosta/git/RIOT-OS/RIOT/drivers/enc28j60/enc28j60.c:337:19: error: comparison of integers of different signs: 'int' and
'unsigned int' [-Werror,-Wsign-compare]
if (res++ >= STARTUP_TIMEOUT) {
~~~~~ ^ ~~~~~~~~~~~~~~~
2 errors generated.- tests_driver_encx24j600 fixed in drivers/encx24j600/encx24j600.c : fix counter var length #7858
/Users/facosta/git/RIOT-OS/RIOT/drivers/encx24j600/encx24j600.c:304:23: error: comparison of integers of different signs: 'int' and
'unsigned int' [-Werror,-Wsign-compare]
for (int i = 0; i < count; i++) {
~ ^ ~~~~~
1 error generated.- tests_driver_isl29125 fixed in tests/driver_isl29125/main.c: fix counter var type #7854
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_isl29125/main.c:88:23: error: comparison of integers of different signs: 'int' and
'unsigned long' [-Werror,-Wsign-compare]
for (int i = 0; i < sizeof(modes); i++) {
~ ^ ~~~~~~~~~~~~~
1 error generated.- tests_driver_lsm6dsl I don't have a solution for this, not sure is a problem...
/Users/facosta/git/RIOT-OS/RIOT/drivers/lsm6dsl/lsm6dsl.c:72:16: error: binary integer literals are a GNU extension
[-Werror,-Wgnu-binary-literal]
if (tmp != LSM6DSL_WHO_AM_I) {
^
/Users/facosta/git/RIOT-OS/RIOT/drivers/lsm6dsl/include/lsm6dsl_internal.h:132:46: note: expanded from macro 'LSM6DSL_WHO_AM_I'
#define LSM6DSL_WHO_AM_I (0b01101010)
^
1 error generated.- tests_driver_nrf24l01p_lowlevel fixed in drivers/nrf24l01p: misc fixed #7855
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_nrf24l01p_lowlevel/main.c:114:34: error: unused parameter 'arg' [-Werror,-Wunused-parameter]
void *nrf24l01p_rx_handler(void *arg)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_nrf24l01p_lowlevel/main.c:212:23: error: comparison of integers of different signs: 'int' and
'unsigned long' [-Werror,-Wsign-compare]
for (int i = 0; i < sizeof(tx_buf); i++) {
~ ^ ~~~~~~~~~~~~~~
2 errors generated.- tests_driver_pdc8544 fixed in drivers/pcd8544/pcd8544.c: fix var lengths #7859
/Users/facosta/git/RIOT-OS/RIOT/drivers/pcd8544/pcd8544.c:317:23: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
for (int i = 0; i < (PCD8544_RES_X * PCD8544_RES_Y / 8); i++) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/drivers/pcd8544/pcd8544.c:334:23: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
for (int i = 0; i < CHAR_WIDTH - 1; i++) {
~ ^ ~~~~~~~~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/drivers/pcd8544/pcd8544.c:353:23: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
for (int i = 0; i < PCD8544_RES_X * PCD8544_ROWS; i++) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.- tests_driver_pn532 I don't have a solution for this one.
/Users/facosta/git/RIOT-OS/RIOT/drivers/include/pn532.h:43:5: error: anonymous unions are a C11 extension [-Werror,-Wc11-extensions]
union {
^
1 error generated.- tests_driver_sdcard_spi fixed in drivers/sdcard_spi #7853
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:43:22: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _init(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:43:35: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _init(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:66:26: error: format specifies type 'unsigned long' but the argument has type
'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf("PSN: %lu\n", card->cid.PSN);
~~~ ^~~~~~~~~~~~~
%u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:58:21: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _cid(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:58:34: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _cid(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:73:21: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _csd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:73:34: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _csd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:138:21: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _sds(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:138:34: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _sds(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:181:55: error: format specifies type 'unsigned long' but the argument has
type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf(" bytes (%lu,%03lu GiB | %lu,%03lu GB)\n", gib_int, gib_frac, gb_int, gb_frac);
~~~ ^~~~~~~
%u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:181:64: error: format specifies type 'unsigned long' but the argument has
type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf(" bytes (%lu,%03lu GiB | %lu,%03lu GB)\n", gib_int, gib_frac, gb_int, gb_frac);
~~~~~ ^~~~~~~~
%03u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:181:74: error: format specifies type 'unsigned long' but the argument has
type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf(" bytes (%lu,%03lu GiB | %lu,%03lu GB)\n", gib_int, gib_frac, gb_int, gb_frac);
~~~ ^~~~~~
%u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:181:82: error: format specifies type 'unsigned long' but the argument has
type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf(" bytes (%lu,%03lu GiB | %lu,%03lu GB)\n", gib_int, gib_frac, gb_int, gb_frac);
~~~~~ ^~~~~~~
%03u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:165:22: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _size(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:165:35: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _size(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:281:23: error: comparison of integers of different signs: 'int' and
'unsigned long' [-Werror,-Wsign-compare]
for (int i = 0; i < sizeof(buffer); i++) {
~ ^ ~~~~~~~~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:338:48: error: format specifies type 'long' but the argument has type
'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
printf("available sectors on card: %li\n", sdcard_spi_get_sector_count(card));
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%u
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:336:30: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
static int _sector_count(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sdcard_spi/main.c:336:43: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
static int _sector_count(int argc, char **argv)
^
19 errors generated.- tests_driver_servo fixed in tests/driver_servo/main.c: fix var len #7852
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_servo/main.c:73:17: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
if (pos <= STEP_LOWER_BOUND || pos >= STEP_UPPER_BOUND) {
~~~ ^ ~~~~~~~~~~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_servo/main.c:73:44: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
if (pos <= STEP_LOWER_BOUND || pos >= STEP_UPPER_BOUND) {
~~~ ^ ~~~~~~~~~~~~~~~~
2 errors generated.- tests_driver_sx127x fixed in drivers/sx127x: Fix misc variable types and lengths #7851
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:118:20: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
int random_cmd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:118:33: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
int random_cmd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:222:21: error: format specifies type 'int' but the argument has type
'unsigned long' [-Werror,-Wformat]
argv[1], strlen(argv[1]) + 1);
^~~~~~~~~~~~~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:234:20: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
int listen_cmd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:234:33: error: unused parameter 'argv' [-Werror,-Wunused-parameter]
int listen_cmd(int argc, char **argv)
^
/Users/facosta/git/RIOT-OS/RIOT/tests/driver_sx127x/main.c:326:26: error: unused parameter 'arg' [-Werror,-Wunused-parameter]
void *_recv_thread(void *arg)
^
6 errors generated.-
lwmac have a ton of warnings, however it requires more exhaustive testing. Also, AFAIK it will be reworked to comply with netif2.
-
tests_periph_flashpage I don't have a fix for this one yet.
/Users/facosta/git/RIOT-OS/RIOT/tests/periph_flashpage/main.c:228:23: error: comparison of integers of different signs: 'int' and
'unsigned long' [-Werror,-Wsign-compare]
for (int i = 0; i < sizeof(page_mem); i++) {
~ ^ ~~~~~~~~~~~~~~~~I tried to make size_t i = 0 but then it throws an error on the case which i cannot be less than 0...
- tests_periph_i2c didn't fix yet
/Users/facosta/git/RIOT-OS/RIOT/tests/periph_i2c/main.c:184:30: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
if (length < 1 || length > BUFSIZE) {
~~~~~~ ^ ~~~~~~~
/Users/facosta/git/RIOT-OS/RIOT/tests/periph_i2c/main.c:232:30: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
if (length < 1 || length > BUFSIZE) {
~~~~~~ ^ ~~~~~~~- tests_periph_pwm don't have a fix yet
/Users/facosta/git/RIOT-OS/RIOT/tests/periph_pwm/main.c:71:33: error: comparison of integers of different signs: 'int' and 'unsigned int'
[-Werror,-Wsign-compare]
if (state <= 0 || state >= STEPS) {
~~~~~ ^ ~~~~~So far is what I found. This is an effort towards #1121.
Reactions are currently unavailable
Metadata
Metadata
Labels
Area: driversArea: Device driversArea: Device driversArea: testsArea: tests and testing frameworkArea: tests and testing frameworkImpact: minorThe PR is small in size and might only require a quick look of a knowledgeable reviewerThe PR is small in size and might only require a quick look of a knowledgeable reviewerState: staleState: The issue / PR has no activity for >185 daysState: The issue / PR has no activity for >185 daysType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)