[dpdk-dev] [PATCH] net/mlx: fix compile errors with ignore pedantic pragma

Bruce Richardson bruce.richardson at intel.com
Mon Sep 19 17:26:05 CEST 2016


On Mon, Sep 19, 2016 at 04:59:59PM +0200, Adrien Mazarguil wrote:
> Hi Bruce,
> 
> On Mon, Sep 19, 2016 at 03:36:54PM +0100, Bruce Richardson wrote:
> > With recent gcc versions, e.g. gcc 6.1, compilation of mlx drivers with
> > debug enabled produces lots of errors complaining that "pedantic" is
> > not a warning level that can be ignored.
> > 
> > error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas]
> >  #pragma GCC diagnostic ignored "-pedantic"
> >                                  ^~~~~~~~~~~
> > 
> > These errors can be removed by changing the "-pedantic" to "-Wpedantic".
> 
> Nice to have a workaround, I thought they did not keep the option at all.
> However after testing:
> 
> - It does not seem to work with GCC 4.6 and older, they prefer -pedantic:
>   "warning: unknown option after `#pragma GCC diagnostic' kind".
> 
> - GCC 4.9 (possibly 5.x as well) does not care, can use either -pedantic or
>   -Wpedantic.
> 
> - GCC 6 can only supports -Wpedantic.
> 
> Note we're working toward removing the need for these #pragma in the first
> place as soon as possible, however in the meantime I fear that checking the
> GCC version is necessary.
> 
Depends on how old of GCC version we need to support. From the release notes
it appears that -Wpedantic was introduced in GCC 4.8 (3 1/2 years ago).

https://gcc.gnu.org/gcc-4.8/changes.html

Do we need to support compilation on gcc versions older than this?

Regards,
/Bruce


More information about the dev mailing list