Bug 29467

Summary: -ansi -pedantic accepts _Bool without diagnostic
Product: gcc Reporter: Neil Booth <neil>
Component: cAssignee: Marek Polacek <mpolacek>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, manu
Priority: P3 Keywords: diagnostic
Version: 4.2.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2012-04-18 00:00:00

Description Neil Booth 2006-10-14 11:34:12 UTC
_Bool x;
Comment 1 Andrew Pinski 2006-10-14 15:29:41 UTC
Hmm, isn't _Bool in the implemenation keyword space anyways?
Comment 2 Neil Booth 2006-10-14 16:19:58 UTC
Subject: Re:  -ansi -pedantic accepts _Bool without diagnostic

pinskia at gcc dot gnu dot org wrote:-

> 
> 
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-10-14 15:29 -------
> Hmm, isn't _Bool in the implemenation keyword space anyways?

It is, so is _Complex, and that is diagnosed.  I'm not saying it's
a conformance problem, just that it's probably a bug.
Comment 3 Manuel López-Ibáñez 2012-04-18 16:23:10 UTC
So? Is this a bug or not?
Comment 4 jsm-csl@polyomino.org.uk 2012-04-23 21:22:38 UTC
I'd say it's a quality-of-implementation issue, but it probably would be 
best to diagnose this.  I've added such diagnostics for C11 keywords such 
as _Noreturn and _Static_assert outside C11 mode when adding support for 
those keywords, for example.
Comment 5 Manuel López-Ibáñez 2012-04-23 21:47:30 UTC
So confirmed.
Comment 6 Marek Polacek 2014-04-29 21:24:57 UTC
Potential fix: http://gcc.gnu.org/ml/gcc-patches/2014-04/msg02015.html
Comment 7 Marek Polacek 2014-05-01 07:21:39 UTC
Author: mpolacek
Date: Thu May  1 07:21:07 2014
New Revision: 209971

URL: http://gcc.gnu.org/viewcvs?rev=209971&root=gcc&view=rev
Log:
	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.

Added:
    trunk/gcc/testsuite/gcc.dg/pr29467.c
Modified:
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/declspec-13.c
    trunk/gcc/testsuite/gfortran.dg/bind_c_usage_24_c.c
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_logical_driver.c
Comment 8 Marek Polacek 2014-05-01 07:22:27 UTC
Fixed.