I use a header file that provides inline functions. These functions are not always save in respect to the GCC -Wconversion check.
Now I want to use the -Wconversion check for my code but want to suppress the warning I get for the include file. Edit: When I just add the conversion check to the compiler options I get the diagnostics, omitting -Wconversion gives me a clean compiler run.
Corresponding to this question I surrounded the include with some pragmas:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <lpc177x_8x_crc.h>
#pragma GCC diagnostic pop
Unfortunately this does not suppress the warnings.
warning: conversion to 'int32_t' from 'uint32_t' may change the sign of the result [-Wsign-conversion]
For an easy check you could even try this if you don't have CMSIS available:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
int32_t foo(void)
{
uint32_t result;
return result;
}
#pragma GCC diagnostic pop
The compiler command line arguments are:
arm-none-eabi-gcc.exe -mthumb -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wunreachable-code -W -Wextra -Wall -Wformat=0 -Wconversion -g -O0 -ffunction-sections -fdata-sections -g3 -mcpu=cortex-m3 -c foo.c -o foo.o
I use arm-none-abi-gcc version:
gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded Processors)