From 1aa5ba4e22db332e1ec0f6b018a3eb6163f707ba Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Wed, 14 Oct 2015 06:53:54 +0000 Subject: [PATCH] Fix "#pragma GCC pop_options" gcc/ChangeLog * targhooks.c (default_target_option_pragma_parse): Do not warn if called on behalf of "#pragma GCC pop_options". gcc/testsuite/ChangeLog * gcc.dg/pragma-pop_options-1.c: New test. From-SVN: r228794 --- gcc/ChangeLog | 5 +++++ gcc/targhooks.c | 8 ++++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pragma-pop_options-1.c | 7 +++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pragma-pop_options-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ef5de99856..0e9ce3f4392 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-14 Dominik Vogt + + * targhooks.c (default_target_option_pragma_parse): Do not warn if + called on behalf of "#pragma GCC pop_options". + 2015-10-14 Tom de Vries * cfganal.c (verify_no_unreachable_blocks): New function. diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 7238c8f8013..5077ec97de1 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1305,8 +1305,12 @@ bool default_target_option_pragma_parse (tree ARG_UNUSED (args), tree ARG_UNUSED (pop_target)) { - warning (OPT_Wpragmas, - "#pragma GCC target is not supported for this machine"); + /* If args is NULL the caller is handle_pragma_pop_options (). In that case, + emit no warning because "#pragma GCC pop_target" is valid on targets that + do not have the "target" pragma. */ + if (args) + warning (OPT_Wpragmas, + "#pragma GCC target is not supported for this machine"); return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c4fd225d4a0..da0015284be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-10-14 Dominik Vogt + + * gcc.dg/pragma-pop_options-1.c: New test. + 2015-10-13 Jakub Jelinek Aldy Hernandez diff --git a/gcc/testsuite/gcc.dg/pragma-pop_options-1.c b/gcc/testsuite/gcc.dg/pragma-pop_options-1.c new file mode 100644 index 00000000000..4e969de6c90 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pragma-pop_options-1.c @@ -0,0 +1,7 @@ +/* Check warnings produced by #pragma GCC push/pop/reset_options. */ +/* { dg-do assemble } */ + +#pragma push_options +#pragma pop_options + +int foo; -- 2.30.2