[Buildroot] [PATCH 1/1] toolchain/helpers.mk: fixup check_gcc_version.
Arnout Vandecappelle
arnout at mind.be
Tue Feb 21 14:33:34 UTC 2017
On 21-02-17 10:26, Thomas Petazzoni wrote:
> Hello,
>
> On Tue, 21 Feb 2017 17:04:36 +0800, Guo Ren wrote:
>
>> - real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/;'` ; \
>> + real_version=`$(1) --version | sed -r -e '1!d; s/^.+\)[[:space:]]*([^[:space:]]+)/\1/;'` ; \
>
> At some point, isn't something like:
>
> echo "__GNUC__.__GNUC_MINOR__" | gcc -P -E - | sed 's/ //g'
>
> simpler, more readable and probably more robust?
Sounds good to me. I ran that on my 300 toolchains and it seems to work. One
thing however: some of them generate a few empty lines at the beginning, so the
sed expression should also have /^$/d.
Regards,
Arnout
>
> Bonus points if you find a way to not have the spaces around the "." in
> the output generated by the preprocessor, which would avoid the need to
> call sed.
>
> Best regards,
>
> Thomas
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
More information about the buildroot
mailing list