This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C PATCH] Warn about booleans in C89 mode (PR c/29467)


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  <polacek@redhat.com>

	PR c/29467
	* 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
	to bool.
	* gfortran.dg/c_f_pointer_logical_driver.c: Change _Bool to bool.
OK.  Thanks.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]