------- Comment #2 from sldev327 at softmagi dot com  2008-01-13 05:52 -------
I as well will leave the argument about syntax to more knowledgeable people.

As to the validity of this PR, at the very least g++'s behavior is
inconsistent.    I suppose a case like df3.cpp is what the warning was intended
for.

g++ warns about __attribute__((dllimport)) not being there on line 7 of df.cpp
(when in truth it is), and then goes on to honor it anyway as you can see
comparing the output df.s and df3.s.

## begin df3.cpp
__attribute__((dllimport)) int bar();

class Foo
{
private:
    int foo();
    friend int bar();  // dllimport removed
};

int Foo::foo()
{
    return bar();
}
# end df3.cpp

D:> g++ -S df3.cpp
df3.cpp:7: warning: 'int bar()' redeclared without dllimport attribute:
previous dllimport ignored

D:> diff -u df.s df3.s
--- df.s        Sun Jan 13 14:02:58 2008
+++ df3.s       Sun Jan 13 14:04:51 2008
@@ -1,4 +1,4 @@
-       .file   "df.cpp"
+       .file   "df3.cpp"
        .text
        .align 2
 .globl __ZN3Foo3fooEv
@@ -11,8 +11,7 @@
 LCFI1:
        subl    $8, %esp
 LCFI2:
-       movl    __imp___Z3barv, %eax
-       call    *%eax
+       call    __Z3barv
        leave
        ret
 LFE2:
@@ -55,3 +54,4 @@
        .uleb128 0x5
        .align 4
 LEFDE1:
+       .def    __Z3barv;       .scl    2;      .type   32;     .endef


-- 


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

Reply via email to