This is the mail archive of the
mailing list for the GCC project.
Re: [C PATCH] Warn about booleans in C89 mode (PR c/29467)
- From: Jeff Law <law at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 30 Apr 2014 15:13:59 -0600
- Subject: Re: [C PATCH] Warn about booleans in C89 mode (PR c/29467)
- Authentication-results: sourceware.org; auth=none
- References: <20140429211827 dot GD11802 at redhat dot com>
On 04/29/14 15:18, Marek Polacek wrote:
Boolean types were introduced with the advent of C99, which means
we should pedwarn when _Bool is used in ansi/c89/c90/iso9899:1990
mode with -Wpedantic, similarly what we do for _Complex.
We don't warn for system headers, so it's possible to include
<stdbool.h> and then use bool. I made use of that to fix some
fortran tests (it's not possible to add dg-options, since these
tests we're using C files via dg-additional-source).
Regtested/bootstrapped on x86_64-linux, ok for trunk?
2014-04-29 Marek Polacek <email@example.com>
* c-decl.c (declspecs_add_type): Pedwarn if boolean types are used
in C89 mode.
* gcc.dg/pr29467.c: New test.
* gcc.dg/declspec-13.c: Renumber some dg-warnings. Add dg-warnings
about boolean types.
* gfortran.dg/bind_c_usage_24_c.c: Include <stdbool.h>. Change _Bool
* gfortran.dg/c_f_pointer_logical_driver.c: Change _Bool to bool.