This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use "redefine_extname" with expansion under Solaris.


On Thu, Jan 26, 2006 at 12:38:22PM -0800, Mark Mitchell wrote:
> Mike Stump wrote:
> 
> > Rather than have 100 ports all ignoring this and having each port 
> > slightly different, I think I'd rather have all ports do this 
> > unconditionally and have any port that had to have it be machine 
> > specific then be different.  Having them all different prevents 
> > writting portable code, enable portable code is a nice goal of the 
> > compiler.
> 
> I tend to agree, especially after noticing that our documentation
> specifically says that we support this #pragma for compatibility with
> SunPRO, which does the expansion.
> 
> So, Carlos, I'm going to simplify this patch for you: just change it
> unconditionally to use c_register_pragma_with_expansion.  No target
> header changes, no target documentation to write.  However, you do get
> to update the wwwdocs/gcc-4.2/changes.html file, under language-specific
> improvements, since this is a user-visible change in semantics.
> 
> That simple change is preapproved.

Both changes attached.

GCC changes tested with no regressions on x86_64-pc-linux-gnu. Tests
still running on sparc-sun-solaris2.8.

The test is enabled only for targets that define
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME e.g. Provide support for the
pragma via targetm.

Cheers,
Carlos.
-- 
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716

2006-01-27  Carlos O'Donell  <carlos@codesourcery.com>

	* htdocs/gcc-4.2/changes.html (C family): pragma
	redefine_extname now macro expands its tokens.

Index: htdocs/gcc-4.2/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.2/changes.html,v
retrieving revision 1.1
diff -u -p -r1.1 changes.html
--- htdocs/gcc-4.2/changes.html	19 Nov 2005 04:37:35 -0000	1.1
+++ htdocs/gcc-4.2/changes.html	27 Jan 2006 17:29:57 -0000
@@ -17,6 +17,14 @@
 
 <h2>New Languages and Language specific improvements</h2>
 
+<h3>C family</h3>
+
+  <ul>
+    <li>The pragma <code>redefine_extname</code> will now 
+        macro expand its tokens for compatibility with 
+        SunPRO.</li>
+  </ul>
+
 <h2>New Targets and Target Specific Improvements</h2>
 
 <h2><a name="obsolete_systems">Obsolete Systems</a></h2>
===================================================================

gcc/

2006-01-27  Carlos O'Donell  <carlos@codesourcery.com>

	* c-pragma.c (init_pragma) : Call c_register_pragma_with_expansion
	for pragma redefine_extname.
	
gcc/testsuite/

2006-01-27  Carlos O'Donell  <carlos@codesourcery.com>

	* gcc.dg/pragma-re-4.c: New test.

Index: gcc/testsuite/gcc.dg/pragma-re-4.c
===================================================================
--- gcc/testsuite/gcc.dg/pragma-re-4.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pragma-re-4.c	(revision 0)
@@ -0,0 +1,18 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc. */
+/* Contributed by Carlos O'Donell on 2006-01-27 */
+
+/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
+/* { dg-do compile { target *-*-solaris* } } */
+/* { dg-final { scan-assembler "_foo" } } */
+/* { dg-final { scan-assembler-not "_foo64" } } */
+
+#define foo     _foo
+#define foo64   _foo64
+extern int foo(void);
+extern int foo64(void);
+#pragma redefine_extname foo64 foo
+int
+bar()
+{
+        return (foo64());
+}
Index: gcc/c-pragma.c
===================================================================
--- gcc/c-pragma.c	(revision 110302)
+++ gcc/c-pragma.c	(working copy)
@@ -817,7 +817,7 @@
 
   c_register_pragma ("GCC", "diagnostic", handle_pragma_diagnostic);
 
-  c_register_pragma (0, "redefine_extname", handle_pragma_redefine_extname);
+  c_register_pragma_with_expansion (0, "redefine_extname", handle_pragma_redefine_extname);
   c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
 
 #ifdef REGISTER_TARGET_PRAGMAS


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]