------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-01-18 18:49 
-------
(In reply to comment #5)
> __USER_LABEL_PREFIX__ should be a string already.
> 
> so you just need:
> extern void bar (void);
> extern __typeof(bar) bar __asm__(__USER_LABEL_PREFIX__ "foo");
> void bar (void) { ; }
> extern __typeof(bar) gee __attribute__((__alias__("foo")));

That one gives: c.c:2: error: expected string literal before ‘_’

__USER_LABEL_PREFIX__ is a string in the compiler config macros. For user code,
the macro expands to the underscore itself.

Actually, the problem with libgfortran is that it uses __USER_LABEL_PREFIX__
already, but it uses it for both __asm__ and __attribute__((__alias__(...))),
which is wrong. I'm testing the following patch, but I should really test it on
a machine that has a non-empty __USER_LABEL_PREFIX__. Any idea?

Index: libgfortran.h
===================================================================
--- libgfortran.h       (revision 120891)
+++ libgfortran.h       (working copy)
@@ -126,10 +126,10 @@
 # define export_proto(x)       sym_rename(x, PREFIX(x))
 # define export_proto_np(x)    extern char swallow_semicolon
 # define iexport_proto(x)      internal_proto(x)
-# define iexport(x)            iexport1(x, __USER_LABEL_PREFIX__, IPREFIX(x))
-# define iexport1(x,p,y)       iexport2(x,p,y)
-# define iexport2(x,p,y) \
-       extern __typeof(x) PREFIX(x) __attribute__((__alias__(#p #y)))
+# define iexport(x)            iexport1(x, IPREFIX(x))
+# define iexport1(x,y)         iexport2(x,y)
+# define iexport2(x,y) \
+       extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y)))
 /* ??? We're not currently building a dll, and it's wrong to add dllexport
    to objects going into a static library archive.  */
 #elif 0 && defined(HAVE_ATTRIBUTE_DLLEXPORT)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30007

Reply via email to