4.6-11.11 seems to misdetect some files as system header and implicit extern "C"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro Android |
Won't Fix
|
Undecided
|
Bernhard Rosenkraenzer | ||
Linaro GCC |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Trying to build Android ICS with 4.6-11.11 results in a number of errors, e.g.:
frameworks/
Initially, I suspected some header has an unclosed extern "C" { somewhere, but after looking at the preprocessor output, the problem seems to be that gcc marks certain files as system header and implicitly extern "C" when they're clearly non-system C++ headers (flags 3 and 4 set in the # lines in preprocessor output).
Problematic bits in the attached sample include
# 1 "frameworks/
# 23 "frameworks/
# 1 "frameworks/
# 22 "frameworks/
Is there any reason why the compiler is marking those "3 4"?
It's certainly unexpected and there doesn't seem to be an easy workaround.
FWIW the call that produces this is
/opt/android- toolchain- 11.11/bin/ arm-eabi- g++ -I dalvik/ libnativehelper /include/ nativehelper -I external/ skia/include/ core -I external/ skia/include/ core -I ./frameworks/ base/include/ media/stagefrig ht/openmax -I external/ icu4c/common -I external/expat/lib -I system/ media/audio_ effects/ include -I frameworks/ base/media/ libmedia -I out/target/ product/ panda/obj/ SHARED_ LIBRARIES/ libmedia_ intermediates -I out/target/ product/ panda/obj/ STATIC_ LIBRARIES/ libwebcore_ intermediates -I dalvik/ libnativehelper /include/ nativehelper -isystem system/core/include -isystem hardware/ libhardware/ include -isystem hardware/ libhardware_ legacy/ include -isystem hardware/ ril/include -isystem dalvik/ libnativehelper /include -isystem frameworks/ base/include -isystem frameworks/ base/opengl/ include -isystem frameworks/ base/native/ include -isystem external/ skia/include -isystem out/target/ product/ panda/obj/ include -isystem bionic/ libc/arch- arm/include -isystem bionic/libc/include -isystem bionic/ libstdc+ +/include -isystem bionic/ libc/kernel/ common -isystem bionic/ libc/kernel/ arch-arm -isystem bionic/libm/include -isystem bionic/ libm/include/ arm -isystem bionic/ libthread_ db/include -c -fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections -fdata-sections -funwind-tables -fstack-protector -Wa,--noexecstack -Werror= format- security -fno-short-enums -march=armv7-a -mfloat-abi=softfp -mfpu=neon -include system/ core/include/ arch/linux- arm/AndroidConf ig.h -I system/ core/include/ arch/linux- arm/ -Wno-psabi -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror= non-virtual- dtor -Werror=address -Werror= sequence- point -DNDEBUG -g -Wstrict-aliasing=2 -fgcse-after-reload -frerun- cse-after- loop -frename-registers -DNDEBUG -UDEBUG -fvisibility- inlines- hidden -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -Werror=return-type -Werror= non-virtual- dtor -Werror=address -Werror= sequence- point -DNDEBUG -UDEBUG -mthumb -Os -fomit- frame-pointer -fno-strict- aliasing -fno-rtti -E -MD -o out/target/ product/ panda/obj/ SHARED_ LIBRARIES/ libmedia_ intermediates/ AudioTrack. i frameworks/ base/media/ libmedia/ AudioTrack. cpp
So chances are it's detected as a system header because of the "-isystem frameworks/ base/include" bit (which seems ultimately bogus, looks like someone abused -isystem to append something to the include path).
So the only remaining question is why gcc is marking it "4" - AFAIK gcc is supposed to treat all system headers as extern "C"...
Anyway, looks like the best fix is to get rid of the -isystem abuse in ICS