On 28.11.2023 18:47, Alexander Kanavin wrote: > Such constructs are fully allowed by C99: > https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Mixed-Labels-and-Declarations.html#Mixed-Labels-and-Declarations
There's more to this: It may also be a policy of ours (or of any sub-component) to demand that declarations and statements are properly separated. This would therefore need discussing first. > If the flag is present, then building against python 3.12 will fail thusly: > > | In file included from > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/Python.h:44, > | from xen/lowlevel/xc/xc.c:8: > | > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/object.h: > In function 'Py_SIZE': > | > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/object.h:233:5: > error: ISO C90 forbids mixed declarations and code > [-Werror=declaration-after-statement] > | 233 | PyVarObject *var_ob = _PyVarObject_CAST(ob); > | | ^~~~~~~~~~~ > | In file included from > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/Python.h:53: > | > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/cpython/longintrepr.h: > In function '_PyLong_CompactValue': > | > /srv/storage/alex/yocto/build-virt/tmp/work/core2-64-poky-linux/xen-tools/4.17+stable/recipe-sysroot/usr/include/python3.12/cpython/longintrepr.h:121:5: > error: ISO C90 forbids mixed declarations and code > [-Werror=declaration-after-statement] > | 121 | Py_ssize_t sign = 1 - (op->long_value.lv_tag & > _PyLong_SIGN_MASK); > | | ^~~~~~~~~~ > | cc1: all warnings being treated as errors At least by the specific wording of the diagnostic I'm inclined to call this a compiler bug: There's no point in mentioning C90 when -std=gnu99 was passed. > --- a/Config.mk > +++ b/Config.mk > @@ -177,8 +177,6 @@ CFLAGS += -std=gnu99 Just up from here there is CFLAGS += -std=gnu99 Yet there's no HOSTCFLAGS += -std=gnu99 anywhere. Hence ... > CFLAGS += -Wall -Wstrict-prototypes > > -$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) ... imo this removal is inappropriate. Jan > -$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) > $(call cc-option-add,CFLAGS,CC,-Wno-unused-but-set-variable) > $(call cc-option-add,CFLAGS,CC,-Wno-unused-local-typedefs) >