Patchwork Small c-pragma.c cleanup

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 28, 2010, 7:29 p.m.
Message ID <1288294147-32401-2-git-send-email-bonzini@gnu.org>
Download mbox | patch
Permalink /patch/69490/
State New
Headers show

Comments

Paolo Bonzini - Oct. 28, 2010, 7:29 p.m.
HANDLE_PRAGMA_VISIBILITY is always defined, no need to test it with
#ifdefs.

Bootstrapped/regtested x86_64-pc-linux-gnu, ok for mainline?

Paolo

c-family:
2010-06-02  Paolo Bonzini  <bonzini@gnu.org>

        * c-pragma.h (HANDLE_PRAGMA_VISIBILITY): Remove.
        (HANDLE_PRAGMA_WEAK, HANDLE_PRAGMA_PACK): Move defaults...
        * c-pragma.c: ... here.
        (handle_pragma_visibility): Remove #ifdefs.

cp:
2010-06-02  Paolo Bonzini  <bonzini@gnu.org>

        * name-lookup.c (handle_namespace_attrs): Assume
        HANDLE_PRAGMA_VISIBILITY is defined.
        * parser.c (cp_parser_namespace_definition): Likewise.

Patch

Index: gcc/c-family/c-pragma.h
===================================================================
--- gcc/c-family/c-pragma.h	(branch diag)
+++ gcc/c-family/c-pragma.h	(working copy)
@@ -75,26 +75,6 @@  typedef enum pragma_omp_clause {
 #define HANDLE_PRAGMA_PACK 1
 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
 
-/* It's safe to always leave visibility pragma enabled as if
-   visibility is not supported on the host OS platform the
-   statements are ignored.  */
-#define HANDLE_PRAGMA_VISIBILITY 1
 extern void push_visibility (const char *, int);
 extern bool pop_visibility (int);
 
Index: gcc/c-family/c-pragma.c
===================================================================
--- gcc/c-family/c-pragma.c	(branch diag)
+++ gcc/c-family/c-pragma.c	(working copy)
@@ -616,8 +632,11 @@  maybe_apply_renaming_pragma (tree decl, 
   return 0;
 }
 
+
+/* It's safe to always leave visibility pragma enabled as if
+   visibility is not supported on the host OS platform the
+   statements are ignored.  */
 
-#ifdef HANDLE_PRAGMA_VISIBILITY
 static void handle_pragma_visibility (cpp_reader *);
 
 static VEC (int, heap) *visstack;
@@ -710,8 +729,7 @@  handle_pragma_visibility (cpp_reader *du
     warning (OPT_Wpragmas, "junk at end of %<#pragma GCC visibility%>");
 }
 
-#endif
-
+
 static void
 handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
 {
@@ -1329,10 +1347,8 @@  init_pragma (void)
 #ifdef HANDLE_PRAGMA_WEAK
   c_register_pragma (0, "weak", handle_pragma_weak);
 #endif
-#ifdef HANDLE_PRAGMA_VISIBILITY
-  c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
-#endif
 
+  c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
   c_register_pragma ("GCC", "diagnostic", handle_pragma_diagnostic);
   c_register_pragma ("GCC", "target", handle_pragma_target);
   c_register_pragma ("GCC", "optimize", handle_pragma_optimize);
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(branch diag)
+++ gcc/cp/parser.c	(working copy)
@@ -13776,10 +13776,8 @@  cp_parser_namespace_definition (cp_parse
   /* Parse the body of the namespace.  */
   cp_parser_namespace_body (parser);
 
-#ifdef HANDLE_PRAGMA_VISIBILITY
   if (has_visibility)
     pop_visibility (1);
-#endif
 
   /* Finish the namespace.  */
   pop_namespace ();
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(branch diag)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -3239,7 +3239,6 @@  handle_namespace_attrs (tree ns, tree at
       tree name = TREE_PURPOSE (d);
       tree args = TREE_VALUE (d);
 
-#ifdef HANDLE_PRAGMA_VISIBILITY
       if (is_attribute_p ("visibility", name))
 	{
 	  tree x = args ? TREE_VALUE (args) : NULL_TREE;
@@ -3260,7 +3259,6 @@  handle_namespace_attrs (tree ns, tree at
 	  saw_vis = true;
 	}
       else
-#endif
 	{
 	  warning (OPT_Wattributes, "%qD attribute directive ignored",
 		   name);