size_t vs int usage

I’m getting several failures on MIPS with size_t vs int usage in this PR (#9368)

eg:

Building application "tests_driver_ata8520e" for "pic32-clicker" with MCU "mips_pic32mx".

main.c: In function 'ata8520e_sigfox_cmd':
main.c:84:24: error: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Werror=format=]
                        "message length is %d", SIGFOX_MAX_TX_LENGTH, strlen(argv[2]));

IIRC size_t is unsigned so the error is correct, how did this code get upstream, and how come no one else is getting this error ?

I presume the fact that this PR add SPI support for MIPS(PIC32) these drivers are now getting built for MIPS, but how is this not a failure on other architectures ?

Should I fix these in this PR or create another one ?

Cheers,

Neil



Hi Neil,

IIRC size_t is unsigned so the error is correct, how did this code get upstream, and how come no one else is getting this error ?

I suppose the toolchain is compiled with different default warning flags.

I presume the fact that this PR add SPI support for MIPS(PIC32) these drivers are now getting built for MIPS, but how is this not a failure on other architectures ?

Should I fix these in this PR or create another one ?

Usually another PR (or even multiples) are preferable. Trivial one-line PR's are usually merged *very* quickly. :slight_smile:

Kaspar

“and how come no one else is getting this error ?”

Probably you are the first to build it with GCC 7.x :slight_smile:

It has stricter rules regarding variable types.

“and how come no one else is getting this error ?”

Probably you are the first to build it with GCC 7.x :slight_smile:

gcc version 4.9.2 (Codescape GNU Tools 2016.05-03 for MIPS MTI Bare Metal)