public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix "#pragma GCC pop_options" warning.
@ 2015-10-13 12:02 Dominik Vogt
  2015-10-13 12:28 ` Bernd Schmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Vogt @ 2015-10-13 12:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Stefan Liebler

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

When "#pragma GCC pop_options" is used on a platform without
support for "#pragma GCC target", Gcc emits a warning.  As
pop_options is useful on targets without the target pragma to
restore optimizations flags, the warning should be removed.

The attached patch does that rather inelegantly by checking if the
pragma_parse hook points to the default implementation.  I could't
think of a similarly terse but less clumsy way.  Suggestions for a
better test are very welcome.

gcc/ChangeLog:

	* c-pragma.c: Include targhooks.h.
	(handle_pragma_pop_options): Do not call
	default_target_option_pragma_parse to prevent its warning when using
	"#pragma GCC pop_options" on platforms that do not support
	"#pragma GCC target".

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-Fix-pragma-GCC-pop_options-warning.patch --]
[-- Type: text/x-diff, Size: 1188 bytes --]

From d149dd8b9d6c9f720809de3839f2ad5a6825f7e5 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 13 Oct 2015 12:55:21 +0100
Subject: [PATCH] Fix "#pragma GCC pop_options" warning.

---
 gcc/c-family/c-pragma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 3c34800..b209b7b 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm_p.h"		/* For REGISTER_TARGET_PRAGMAS (why is
 				   this not a target hook?).  */
 #include "target.h"
+#include "targhooks.h"
 #include "diagnostic.h"
 #include "opts.h"
 #include "plugin.h"
@@ -997,7 +998,9 @@ handle_pragma_pop_options (cpp_reader *ARG_UNUSED(dummy))
 
   if (p->target_binary != target_option_current_node)
     {
-      (void) targetm.target_option.pragma_parse (NULL_TREE, p->target_binary);
+      if (targetm.target_option.pragma_parse
+	  != default_target_option_pragma_parse)
+	(void) targetm.target_option.pragma_parse (NULL_TREE, p->target_binary);
       target_option_current_node = p->target_binary;
     }
 
-- 
2.3.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-13 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 12:02 [PATCH] Fix "#pragma GCC pop_options" warning Dominik Vogt
2015-10-13 12:28 ` Bernd Schmidt
2015-10-13 13:31   ` Dominik Vogt
2015-10-13 14:33     ` Bernd Schmidt
2015-10-13 15:03       ` Dominik Vogt
2015-10-13 15:05         ` Bernd Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).