How do I disable warnings across versions?
Vincent Lefevre
vincent+gcc@vinc17.org
Tue May 15 12:51:00 GMT 2012
On 2012-05-15 12:29:35 +0200, Manuel López-Ibáñez wrote:
> On 15 May 2012 12:22, Vincent Lefevre <vincent+gcc@vinc17.org> wrote:
> > #pragma GCC diagnostic ignored "-Wpragmas"
> > #pragma GCC diagnostic ignored "-Wuninitialized"
> > #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
> > #pragma GCC diagnostic ignored "-Wfoo"
> > #pragma GCC diagnostic warning "-Wpragmas"
> > #pragma GCC diagnostic ignored "-Wbar"
> >
> > will just give a warning concerning -Wbar.
>
> And I think that in the same way we ignore -Wno-foo if no warnings are
> given, we should ignore:
>
> > #pragma GCC diagnostic ignored "-Wfoo"
I suppose that this is intentional, as
http://gcc.gnu.org/gcc-4.4/changes.html says:
Unknown -Wno-* options are now silently ignored by GCC if no other
diagnostics are issued. If other diagnostics are issued, then GCC
warns about the unknown options.
> Note that you can test for the exact version of GCC with #ifdef
> GCC_MAJOR >= 4 && GCC_MINOR >= 7.
They don't exist.
$ gcc-4.7 -dM -E -xc /dev/null | grep GCC
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
#define __GCC_HAVE_DWARF2_CFI_ASM 1
#define __GCC_ATOMIC_INT_LOCK_FREE 2
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
GMP and MPFR have such macros. It would be a nice addition to GCC,
but with the __GCC prefix.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the Gcc-help
mailing list