This is the mail archive of the gcc-bugs@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]

[Bug c++/17115] New: -Winline does not respect __attribute__((__noinline__))


This is could be regarded as a feature or missing documentation, but I was very
suprised finding out that -Winline does not respect _attribute__((__noinline__)).

Consider this code:

struct Foo {
            __attribute__((noinline)) int a(int r) { return r & 1; }
    virtual __attribute__((noinline)) int b(int r) { return r & 1; }
    static  __attribute__((noinline)) int c(int r) { return r & 1; }
};

int bar(int r) {
    Foo f;
    int k = 1; k &= f.a(r); k &= f.b(r); k &= f.a(r);
    return k;
}

> g++-3.5 -O2 -Winline -c x.cpp
x.cpp: In function `int bar(int)':
x.cpp:2: warning: inlining failed in call to 'int Foo::a(int)': function not
inlinable
x.cpp:9: warning: called from here
x.cpp:3: warning: inlining failed in call to 'virtual int Foo::b(int)': function
not inlinable
x.cpp:9: warning: called from here
x.cpp:2: warning: inlining failed in call to 'int Foo::a(int)': function not
inlinable
x.cpp:9: warning: called from here


Somewhat related is the usage of both -Winline and -fno-default-inline - I would
expect that -Winline would ignore non-inlines that result from
-fno-default-inline but still warns about other (e.g. global) non-inlined
functions. But currently it warns about every member function.

-- 
           Summary: -Winline does not respect __attribute__((__noinline__))
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markus at oberhumer dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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