]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix "#pragma GCC pop_options"
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Oct 2015 06:53:54 +0000 (06:53 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Oct 2015 06:53:54 +0000 (06:53 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228794 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/targhooks.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pragma-pop_options-1.c [new file with mode: 0644]

index 9ef5de998562e6614f3eecb07761793fc65734c4..0e9ce3f43927f21606f4414225550b9301421d48 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-14  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       * 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  <tom@codesourcery.com>
 
        * cfganal.c (verify_no_unreachable_blocks): New function.
index 7238c8f8013c339fec52daa255aa5054ca37f4cf..5077ec97de1b11487c914aad2771f7dc58e594cd 100644 (file)
@@ -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;
 }
index c4fd225d4a05cad166fe0f2dee2c86d09868f700..da0015284be2b64e86c2de9fe8c5a92bbca46ea8 100644 (file)
@@ -1,3 +1,7 @@
+2015-10-14  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       * gcc.dg/pragma-pop_options-1.c: New test.
+
 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
 
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 (file)
index 0000000..4e969de
--- /dev/null
@@ -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;