Patchwork RFA: darwin PATCH to fix build, internal visibility

login
register
mail settings
Submitter Jason Merrill
Date Oct. 3, 2012, 7:04 p.m.
Message ID <506C8C3B.2010705@redhat.com>
Download mbox | patch
Permalink /patch/188921/
State New
Headers show

Comments

Jason Merrill - Oct. 3, 2012, 7:04 p.m.
This patch fixes a couple of Darwin issues I noticed with a cross-compiler:

1) Adds a couple of consts to avoid const-correctness errors.
2) Treats visibility "internal" like "hidden" rather than like 
"default".  The documentation says that internal is hidden + 
processor-specific semantics, so treating it as just hidden makes sense 
to me.

OK for trunk?

Jason
Mike Stump - Oct. 3, 2012, 10:26 p.m.
On Oct 3, 2012, at 12:04 PM, Jason Merrill <jason@redhat.com> wrote:
> This patch fixes a couple of Darwin issues I noticed with a cross-compiler:
> 
> 1) Adds a couple of consts to avoid const-correctness errors.
> 2) Treats visibility "internal" like "hidden" rather than like "default".  The documentation says that internal is hidden + processor-specific semantics, so treating it as just hidden makes sense to me.
> 
> OK for trunk?

Ok.
Jack Howarth - Oct. 4, 2012, 1:41 p.m.
On Wed, Oct 03, 2012 at 03:26:14PM -0700, Mike Stump wrote:
> On Oct 3, 2012, at 12:04 PM, Jason Merrill <jason@redhat.com> wrote:
> > This patch fixes a couple of Darwin issues I noticed with a cross-compiler:
> > 
> > 1) Adds a couple of consts to avoid const-correctness errors.
> > 2) Treats visibility "internal" like "hidden" rather than like "default".  The documentation says that internal is hidden + processor-specific semantics, so treating it as just hidden makes sense to me.
> > 
> > OK for trunk?
> 
> Ok.


FYI, the x86_64-apple-darwin12 testsuite results with the proposed patch are at...

http://gcc.gnu.org/ml/gcc-testresults/2012-10/msg00434.html

It appears that the patch should also special case the "scan-assembler \\\\.internal.*Foo.methodEv"
tests in g++.dg/ext/visibility/pragma-override1.C and g++.dg/ext/visibility/pragma-override2.C 
on darwin as well...

FAIL: g++.dg/ext/visibility/pragma-override1.C -std=c++98  scan-assembler \\\\.internal.*Foo.methodEv
FAIL: g++.dg/ext/visibility/pragma-override1.C -std=c++11  scan-assembler \\\\.internal.*Foo.methodEv
FAIL: g++.dg/ext/visibility/pragma-override2.C -std=c++98  scan-assembler \\\\.internal.*Foo.methodEv
FAIL: g++.dg/ext/visibility/pragma-override2.C -std=c++11  scan-assembler \\\\.internal.*Foo.methodEv

               Jack
Jason Merrill - Oct. 4, 2012, 3:36 p.m.
On 10/04/2012 09:41 AM, Jack Howarth wrote:
> It appears that the patch should also special case the "scan-assembler \\\\.internal.*Foo.methodEv"
> tests in g++.dg/ext/visibility/pragma-override1.C and g++.dg/ext/visibility/pragma-override2.C
> on darwin as well...

Done, thanks.

Jason

Patch

commit 907f8d9588da2e65cf938985639bfaf0dde53c6f
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Oct 3 09:55:25 2012 -0400

    	* config/darwin.c (darwin_assemble_visibility): Treat
    	VISIBILITY_INTERNAL as hidden.
    
    	* config/darwin-c.c (find_subframework_file): Add missing const.
    	(framework_construct_pathname): Likewise.

diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index a642f66..8e48c30 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -267,7 +267,7 @@  static struct framework_header framework_header_dirs[] = {
 static char *
 framework_construct_pathname (const char *fname, cpp_dir *dir)
 {
-  char *buf;
+  const char *buf;
   size_t fname_len, frname_len;
   cpp_dir *fast_dir;
   char *frname;
@@ -344,7 +344,7 @@  find_subframework_file (const char *fname, const char *pname)
 {
   char *sfrname;
   const char *dot_framework = ".framework/";
-  char *bufptr;
+  const char *bufptr;
   int sfrname_len, i, fname_len;
   struct cpp_dir *fast_dir;
   static struct cpp_dir subframe_dir;
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 54c92d1..5a9f50a 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2623,7 +2623,7 @@  darwin_assemble_visibility (tree decl, int vis)
 {
   if (vis == VISIBILITY_DEFAULT)
     ;
-  else if (vis == VISIBILITY_HIDDEN)
+  else if (vis == VISIBILITY_HIDDEN || vis == VISIBILITY_INTERNAL)
     {
       fputs ("\t.private_extern ", asm_out_file);
       assemble_name (asm_out_file,
@@ -2631,7 +2631,7 @@  darwin_assemble_visibility (tree decl, int vis)
       fputs ("\n", asm_out_file);
     }
   else
-    warning (OPT_Wattributes, "internal and protected visibility attributes "
+    warning (OPT_Wattributes, "protected visibility attribute "
 	     "not supported in this configuration; ignored");
 }