I have embedded system project, which I'm testing with Ceedling (=Unity and Cmock).
In one test case code under test is that simple:
uint32_t zero = eeprom_read_dword((uint32_t*)&non_volatile_zero);
sprintf(output, "%lu", zero);
As embedded system is 8-bit architecture, %lu
must be used in sprintf for formatting 32-bit unsigned int for printing. However, desktop environment (GCC) is used for test build and running of tests (and it's not an option to use embedded build for tests). This causes next warning:
warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
62 sprintf(output, "%lu", zero);
~~^ ~~~~
| |
| uint32_t {aka unsigned int}
long unsigned int
%u
Warning itself is correct in the desktop environment, but false positive from the embedded system point of view.
My question is how to set -Wno-format compiler flag for test build as I have not defined tools-section in project.yml at all as default GCC is used? Or maybe there is even a way to tell ceedling that target system is using 8-bit architecture?