[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Only compile the hypervisor with -Wdeclaration-after-statement


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 6 Dec 2023 12:05:29 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Julien Grall <jgrall@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, Quan Xu <quan.xu0@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Alexander Kanavin <alex@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 06 Dec 2023 11:05:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.12.2023 11:52, Julien Grall wrote:
> Hi Jan,
> 
> On 06/12/2023 08:52, Jan Beulich wrote:
>> On 05.12.2023 19:32, Julien Grall wrote:
>>> From: Julien Grall <jgrall@xxxxxxxxxx>
>>>
>>> Right now, all tools and hypervisor will be complied with the option
>>> -Wdeclaration-after-statement. While most of the code in the hypervisor
>>> is controlled by us, for tools we may import external libraries.
>>>
>>> The build will fail if one of them are using the construct we are
>>> trying to prevent. This is the case when building against Python 3.12
>>> and Yocto:
>>>
>>> | 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
>>>
>>> Looking at the tools directory, a fair few directory already add
>>> -Wno-declaration-after-statement to inhibit the default behavior.
>>>
>>> We have always build the hypervisor with the flag, so for now remove
>>> only the flag for anything but the hypervisor. We can decide at later
>>> time whether we want to relax.
>>>
>>> Also remove the -Wno-declaration-after-statement in some subdirectory
>>> as the flag is now unnecessary.
>>
>> With all these removals, don't you need to add the option centrally
>> somewhere? Or else are you sure that no compiler version, including
>> distro-customized ones, would ever come with the warning enabled by
>> default?
> 
> I can't really go through the dozens of different built compilers... But 
> I would find odd that a compiler will force this option. I view it as a 
> style enforcement option and that's not up to a distro to decide what 
> every projects do.
> 
> Also, Allowing your thinking, we would need to add -Wno-switch-default & 
> co just in case a compiler decide to enable it. So where would we stop 
> adding -Wno-*?
> 
> I don't think this is very scalable.

I agree on this point, but: With the change you do there's a (slim) risk
of introducing build breakage. With other -W* / -Wno-* options we haven't
had reports of build issues.

Yet then, thinkking more generally, imo it would be a good idea to always
for either the "yes" or the "no" option for warnings we care about
controlling ourselves. But that's nothing belonging in your change, of
course.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.