-
-
Save MaskRay/bfb4219c0cde7f974b7755071f3fa428 to your computer and use it in GitHub Desktop.
-fgnu89-inline / C99 / C++ inline modes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//__attribute__((gnu_inline)) | |
EXTERN inline int foo(int a) { return a * a; } | |
int bar(int a) { return foo(a+1); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cc=gcc | |
[[ -n $1 ]] && cc=clang | |
for i in "" "-O2" "-fgnu89-inline" "-fgnu89-inline -O2"; do | |
echo ++++$i | |
$cc ${=i} -DEXTERN= -c b.c && readelf -Ws b.o | grep foo | |
echo ++++$i EXTERN=extern | |
$cc ${=i} -DEXTERN=extern -c b.c && readelf -Ws b.o | grep foo | |
done | |
for i in "" "-O2"; do | |
echo ++++c++ $i | |
$cc -xc++ ${=i} -DEXTERN= -c b.c && readelf -Ws b.o | grep foo | |
echo ++++c++ $i EXTERN=extern | |
$cc -xc++ ${=i} -DEXTERN=extern -c b.c && readelf -Ws b.o | grep foo | |
done | |
: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107543
c-family/c-cppbuiltin.cc: Undefine __GNUC_STDC_INLINE__ in C++ mode?