[PATCH] toolchain/gcc: set dialects for each version

Stijn Tintel stijn at linux-ipv6.be
Thu Jan 27 14:11:58 PST 2022


On 27/01/2022 20:10, Bas Mevissen via openwrt-devel wrote:
>
> On 1/25/22 18:02, Stijn Tintel wrote:
>> GCC has an option "-std=" to set the language standard for C and C++.
>> Newer GCC versions sometimes switch to newer standards by default. This
>> has the potential to break the OpenWrt toolchain build whenever a distro
>> introduces a new GCC version that uses a newer dialect by default.
>>
>> Let's set the default dialects used for each of the GCC versions we
>> support, to avoid these toolchain build failures in the future.
>>
>
> Shouldn't the logic be different? It is the software that is to be
> compiled that is written in a certain version or versions of C or C++
> language.

In OpenWiFi we unfortunately use QSDK for the ipq6xxx/ipq8xxx platforms.
This comes with ancient GCC 5, which doesn't build on GCC 11, because
GCC 11 uses -std=gnu++17, causing this problem:

|/home/stijn/Development/TIP/wlan-ap/openwrt/build_dir/toolchain-arm_cortex-a7_gcc-5.5.0_musl_eabi/gcc-5.5.0/gcc/reload1.c:
In function 'void init_reload()':
||/home/stijn/Development/TIP/wlan-ap/openwrt/build_dir/toolchain-arm_cortex-a7_gcc-5.5.0_musl_eabi/gcc-5.5.0/gcc/reload1.c:115:24:
error: use of an operand of type 'bool' in 'operator++' is forbidden in
C++17 ||115 | (this_target_reload->x_spill_indirect_levels) |||
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~|

|Setting the dialects to build GCC 5, to the default dialect used by GCC
5, avoids this problem. However, since QSDK is obviously completely
irrelevant for OpenWrt, I tried finding a general way of avoiding these
kinds of problems. Setting the default dialects would avoid the same
problem in the future, e.g. once GCC 13 forbids some syntax that is used
in some of the GCC versions we still support.|

|Anyway, downstream answer was "won't fix, build on Ubuntu 20.04", so
I'm going to mark this patch as rejected and not waste any more time on it.|

|Stijn |




More information about the openwrt-devel mailing list