From af5216d3e1434791092452c3de983dd52ca131cd Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 9 Jul 2008 15:45:50 +0000 Subject: [PATCH] re PR c++/36760 (Simple std::bind use causes warnings with -Wextra) /cp 2008-07-09 Paolo Carlini PR c++/36760 * pt.c (tsubst_function_type): Don't warn for type qualifiers on function return type in case of system header. /testsuite 2008-07-09 Paolo Carlini PR c++/36760 * g++.dg/warn/pragma-system_header5.C: New. * g++.dg/warn/pragma-system_header5.h: Likewise. From-SVN: r137660 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 1 + gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/warn/pragma-system_header5.C | 10 ++++++++++ gcc/testsuite/g++.dg/warn/pragma-system_header5.h | 3 +++ 5 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/pragma-system_header5.C create mode 100644 gcc/testsuite/g++.dg/warn/pragma-system_header5.h diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fa4419e998a..b68a7951fd9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-07-09 Paolo Carlini + + PR c++/36760 + * pt.c (tsubst_function_type): Don't warn for type qualifiers + on function return type in case of system header. + 2008-07-09 Raksit Ashok * parser.c (cp_parser_postfix_expression): New warning based on flag diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cce706f0705..3fee994a368 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8768,6 +8768,7 @@ tsubst_function_type (tree t, if (TYPE_QUALS (return_type) != TYPE_UNQUALIFIED && in_decl != NULL_TREE && !TREE_NO_WARNING (in_decl) + && !DECL_IN_SYSTEM_HEADER (in_decl) && (SCALAR_TYPE_P (return_type) || VOID_TYPE_P (return_type))) warning (OPT_Wignored_qualifiers, "type qualifiers ignored on function return type"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 755f8e4719c..196c3fa2f87 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-07-09 Paolo Carlini + + PR c++/36760 + * g++.dg/warn/pragma-system_header5.C: New. + * g++.dg/warn/pragma-system_header5.h: Likewise. + 2008-07-09 Raksit Ashok * gcc.dg/wdisallowed-functions-1.c: New test. diff --git a/gcc/testsuite/g++.dg/warn/pragma-system_header5.C b/gcc/testsuite/g++.dg/warn/pragma-system_header5.C new file mode 100644 index 00000000000..771db3d7ce7 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pragma-system_header5.C @@ -0,0 +1,10 @@ +// PR c++/36760 +// { dg-options "-Wextra" } + +#include "pragma-system_header5.h" + +void f() +{ + g(); + g(); +} diff --git a/gcc/testsuite/g++.dg/warn/pragma-system_header5.h b/gcc/testsuite/g++.dg/warn/pragma-system_header5.h new file mode 100644 index 00000000000..5732e4afd3a --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pragma-system_header5.h @@ -0,0 +1,3 @@ +#pragma GCC system_header + +template T g(); -- 2.30.2