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

[gcc 4.7.1] -O and -Winline produce many warnings about inlining destructors even without the 'inline' keyword


Hi everyone,

I'm Edward-san, a contributor of cppcheck (link: https://github.com/danmar/cppcheck ) and I noticed a strange thing when I was compiling it with some particular flags.
It happens with gcc 4.5.2 (the supplied one from Linux Mint 11 packages) and in (the compiled-by-me) gcc 4.7.1 (I had a problem with cloog not being recognized even with the correct version, but it's another matter).


Download the source here: https://github.com/danmar/cppcheck/zipball/master and unzip it somewhere.
In the 'trunk' directory, write: "make lib/check64bit.o 'CXXFLAGS=-Winline -O'.
g++ will output those messages:


g++ -Winline -O -Ilib -c -o lib/check64bit.o lib/check64bit.cpp
In file included from lib/check64bit.h:26:0,
from lib/check64bit.cpp:23:
lib/errorlogger.h: In member function ‘void Check64BitPortability::returnPointerError(const Token*)’:
lib/errorlogger.h:147:36: warning: inlining failed in call to ‘ErrorLogger::ErrorMessage::~ErrorMessage()’: call is unlikely and code size would grow
lib/check.h:125:116: warning: called from here
lib/errorlogger.h: In member function ‘void Check64BitPortability::assignmentIntegerToAddressError(const Token*)’:
lib/errorlogger.h:147:36: warning: inlining failed in call to ‘ErrorLogger::ErrorMessage::~ErrorMessage()’: call is unlikely and code size would grow
lib/check.h:125:116: warning: called from here
lib/errorlogger.h: In member function ‘void Check64BitPortability::assignmentAddressToIntegerError(const Token*)’:
lib/errorlogger.h:147:36: warning: inlining failed in call to ‘ErrorLogger::ErrorMessage::~ErrorMessage()’: call is unlikely and code size would grow
lib/check.h:125:116: warning: called from here
lib/errorlogger.h: In member function ‘void Check64BitPortability::returnIntegerError(const Token*)’:
lib/errorlogger.h:147:36: warning: inlining failed in call to ‘ErrorLogger::ErrorMessage::~ErrorMessage()’: call is unlikely and code size would grow
lib/check.h:125:116: warning: called from here
In file included from lib/check64bit.cpp:23:0:
lib/check.h: In member function ‘virtual void Check64BitPortability::getErrorMessages(ErrorLogger*, const Settings*) const’:
lib/check.h:49:13: warning: inlining failed in call to ‘Check::~Check()’: call is unlikely and code size would grow
lib/check64bit.h:36:56: warning: called from here
lib/check.h: In member function ‘virtual void Check64BitPortability::runChecks(const Tokenizer*, const Settings*, ErrorLogger*)’:
lib/check.h:49:13: warning: inlining failed in call to ‘Check::~Check()’: call is unlikely and code size would grow
lib/check64bit.h:36:56: warning: called from here


but in lib/check64bit.cpp/h there's no 'inline' keyword near the destructors (there's a 'inline' near 'Check::Check' in lib/check.h:148 but doesn't change anything when I remove the keyword). Maybe I don't know something about this... if it's not a false positive, what would it be the fix to this?

g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)


Sincerely,
Edward-san


-- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Conto Corrente Arancio. Carta di credito e prelievi gratis. Scopri i vantaggi!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=12245&d=4-7


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