re PR c/61077 (_Atomic in the return type or argument types of main not diagnosed)

PR c/61077
c-family/
	* c-common.c (check_main_parameter_types): Warn for _Atomic-qualified
	parameter type of main.
c/
	* c-decl.c (start_function): Warn for _Atomic-qualified return type
	of main.
testsuite/
	* gcc.dg/pr61077.c: New test.

From-SVN: r210229
This commit is contained in:
Marek Polacek 2014-05-08 17:42:09 +00:00 committed by Marek Polacek
parent f0fd118f53
commit f827930ae2
6 changed files with 46 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2014-05-08 Marek Polacek <polacek@redhat.com>
PR c/61077
* c-common.c (check_main_parameter_types): Warn for _Atomic-qualified
parameter type of main.
2014-05-07 DJ Delorie <dj@redhat.com>
* c-cppbuiltin.c (print_bits_of_hex): New.

View File

@ -2193,6 +2193,20 @@ check_main_parameter_types (tree decl)
if (type == void_type_node || type == error_mark_node )
break;
tree t = type;
if (TYPE_ATOMIC (t))
pedwarn (input_location, OPT_Wmain,
"%<_Atomic%>-qualified parameter type %qT of %q+D",
type, decl);
while (POINTER_TYPE_P (t))
{
t = TREE_TYPE (t);
if (TYPE_ATOMIC (t))
pedwarn (input_location, OPT_Wmain,
"%<_Atomic%>-qualified parameter type %qT of %q+D",
type, decl);
}
++argct;
switch (argct)
{

View File

@ -1,3 +1,9 @@
2014-05-08 Marek Polacek <polacek@redhat.com>
PR c/61077
* c-decl.c (start_function): Warn for _Atomic-qualified return type
of main.
2014-05-06 Kenneth Zadeck <zadeck@naturalbridge.com>
Mike Stump <mikestump@comcast.net>
Richard Sandiford <rdsandiford@googlemail.com>

View File

@ -8045,6 +8045,9 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
!= integer_type_node)
pedwarn (loc, OPT_Wmain, "return type of %qD is not %<int%>", decl1);
else if (TYPE_ATOMIC (TREE_TYPE (TREE_TYPE (decl1))))
pedwarn (loc, OPT_Wmain, "%<_Atomic%>-qualified return type of %qD",
decl1);
check_main_parameter_types (decl1);

View File

@ -1,3 +1,8 @@
2014-05-08 Marek Polacek <polacek@redhat.com>
PR c/61077
* gcc.dg/pr61077.c: New test.
2014-05-08 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_collectives_1.f90: New.

View File

@ -0,0 +1,12 @@
/* PR c/61077 */
/* { dg-do compile } */
/* { dg-options "-std=c11 -Wall" } */
_Atomic int
main (_Atomic int argc, _Atomic char **argv)
/* { dg-warning "qualified return type" "return" { target *-*-* } 6 } */
/* { dg-warning "qualified parameter type.*int" "parameter" { target *-*-* } 6 } */
/* { dg-warning "qualified parameter type.*char" "parameter" { target *-*-* } 6 } */
{
return 0;
}