Preprocessing with g ++ and specs-file

The question relates to arm-none-eabi-g ++ 6.2 and binding to newlib-nano.

When I pre-process C-source with -specs=nano.specs , the newlib.h file from the newlib-nano directory is included:

 echo '#include <string.h>' |\ /opt/gcc-arm-none-eabi-6_2-2016q4/bin/arm-none-eabi-gcc -specs=nano.specs -xc -E - |\ grep '^# 1 .*newlib\.h' 

displays # 1 "/opt/gcc-arm-none-eabi-6_2-2016q4/arm-none-eabi/include/newlib-nano/newlib.h" 1 3 4 (as expected). This is because the nano.specs file contains (among others) lines

 %rename cpp nano_cpp *cpp: -isystem =/include/newlib-nano %(nano_cpp) 

But if I pass C ++ - source through the same compiler

 echo '#include <string.h>' |\ /opt/gcc-arm-none-eabi-6_2-2016q4/bin/arm-none-eabi-gcc -specs=nano.specs -x c++ -E - |\ grep '^# 1 .*newlib\.h' 

the output reads # 1 "/opt/gcc-arm-none-eabi-6_2-2016q4/arm-none-eabi/include/newlib.h" 1 3 .

In other words: specs file is ignored.

I know that I should include <cstring> instead of <string.h> in C ++ sources and that GNU g ++ is usually called …/arm-none-eabi-c++ instead of …/arm-none-eabi-gcc -x c++ but I did it to cut a little difference. And: this does not change the question.

Question What do I need to add to the specs file so that C ++ files include newlib-nano/newlib.h ?

+6
source share
1 answer

It was a mistake ( https://bugs.launchpad.net/gcc-arm-embedded/+bug/1661882 ). It is fixed. It will be in "update 6-2017-q1."

+1
source

Source: https://habr.com/ru/post/1013884/


All Articles