]> git.ipfire.org Git - thirdparty/gcc.git/commit
include: Fix -Wundef warnings in ansidecl.h
authorMarek Polacek <polacek@redhat.com>
Tue, 20 Jul 2021 20:26:28 +0000 (16:26 -0400)
committerMarek Polacek <polacek@redhat.com>
Sat, 24 Jul 2021 16:51:00 +0000 (12:51 -0400)
commit34dbb5f346459a1b36cd0cfbfe1cf18cd099fdf3
tree1474584ff46cac3fcd7cd344003edcc9e4e44f3a
parentead235f60139edc6eb408d8d083cbb15e417b447
include: Fix -Wundef warnings in ansidecl.h

This quashes -Wundef warnings in ansidecl.h when compiled in C or C++.
In C, __cpp_constexpr and __cplusplus aren't defined so we evaluate
them to 0; conversely, __STDC_VERSION__ is not defined in C++.
This has caused grief when -Wundef is used with -Werror.

I've also tested -traditional-cpp.

include/ChangeLog:

* ansidecl.h: Check if __cplusplus is defined before checking
the value of __cpp_constexpr and __cplusplus.  Don't check
__STDC_VERSION__ in C++.
include/ansidecl.h