diff mbox

rs6000.c visitibility fix and formatting

Message ID CAGWvny=iyhqPjzjTxqtdYqiTErSpJwrok5=fA9mi8=O=B8x1XA@mail.gmail.com
State New
Headers show

Commit Message

David Edelsohn Oct. 20, 2016, 1:17 p.m. UTC
I noticed that rs6000.c rs6000_assemble_visibility has two of the
visibility keywords swapped.  This only is used for ELF with dot
symbols, which are deprecated, so any problems were not apparent, but
it should be fixed.

The function defines the keywords as:

      static const char * const visibility_types[] = {
        NULL, "internal", "hidden", "protected"
      };

It was added in that order by rth in 2002

https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/rs6000/rs6000.c?r1=59559&r2=59558&pathrev=59559

While coretypes.h defines

enum symbol_visibility
{
  VISIBILITY_DEFAULT,
  VISIBILITY_PROTECTED,
  VISIBILITY_HIDDEN,
  VISIBILITY_INTERNAL
};

and

varasm.c default_assemble_visibility similarly defines

  static const char * const visibility_types[] = {
    NULL, "protected", "hidden", "internal"
  };


Also another set of lines are too long by GCC formatting standards.

Bootstrapped on powerpc-ibm-aix7.1.0.0.

Thanks, David

* config/rs6000/rs6000.c (rs6000_assemble_visibility): Swap "internal"
and "protected" in visibility types.
(rs6000_xcoff_declare_function_name): Fix formatting.
(rs6000_xcoff_declare_object_name): Fix formatting.

   fputs (", TOC[tc0], 0\n", file);
@@ -35258,7 +35259,8 @@ rs6000_xcoff_declare_function_name (FILE *file, co
   RS6000_OUTPUT_BASENAME (file, buffer);
   fputs (":\n", file);
   data.function_descriptor = true;
-  symtab_node::get (decl)->call_for_symbol_and_aliases
(rs6000_declare_alias, &data, true);
+  symtab_node::get (decl)->call_for_symbol_and_aliases (rs6000_declare_alias,
+                                                       &data, true);
   if (!DECL_IGNORED_P (decl))
     {
       if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
@@ -35282,7 +35284,8 @@ rs6000_xcoff_declare_object_name (FILE *file, cons
   struct declare_alias_data data = {file, false};
   RS6000_OUTPUT_BASENAME (file, name);
   fputs (":\n", file);
-  symtab_node::get (decl)->call_for_symbol_and_aliases
(rs6000_declare_alias, &data, true);
+  symtab_node::get (decl)->call_for_symbol_and_aliases (rs6000_declare_alias,
+                                                       &data, true);
 }

 /* Overide the default 'SYMBOL-.' syntax with AIX compatible 'SYMBOL-$'. */
diff mbox

Patch

Index: rs6000.c
===================================================================
--- rs6000.c    (revision 241359)
+++ rs6000.c    (working copy)
@@ -22676,7 +22676,7 @@  rs6000_assemble_visibility (tree decl, int vis)
       && TREE_CODE (decl) == FUNCTION_DECL)
     {
       static const char * const visibility_types[] = {
-       NULL, "internal", "hidden", "protected"
+       NULL, "protected", "hidden", "internal"
       };

       const char *name, *type;
@@ -35248,7 +35248,8 @@  rs6000_xcoff_declare_function_name (FILE *file, co
   fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", file);
   RS6000_OUTPUT_BASENAME (file, buffer);
   fputs (":\n", file);
-  symtab_node::get (decl)->call_for_symbol_and_aliases
(rs6000_declare_alias, &data, true);
+  symtab_node::get (decl)->call_for_symbol_and_aliases (rs6000_declare_alias,
+                                                       &data, true);
   fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", file);
   RS6000_OUTPUT_BASENAME (file, buffer);