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

Re: [XEN PATCH v2] x86/cpu-policy: justify a violation of MISRA C:2012 Rule 1.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 2 Aug 2023 11:47:25 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GPHQI3HV/ISYU//I4owjCgl9bftVPfSPRgtTkcbD1a4=; b=ejHHr0kpLipgxDxhZGoNC425P4F+SWhi98ZP9tQ0PNOy+mPoZxdM6CAO5v0zS9IJ8Uk9vlrh2Phm2QV/J8GQmLjpjKMiBDUSDnIV2nzOtC5RzRF4zRqkXxZi9ayUlAFZTahGskQNyVtSQD9oiwdSEQmq62g2bMPFAXrOOUszm7XW/P4TblwxFaf9hKxj5SxBB2exBiqcPtUwsEuMXdde0WlsadfX+4Tjf/8gegjO5S2+GoJQ5wRL34XFr/zBxZLZ0DvRLMkYvOTfK9qf5GijfohJslbBbC/0O4gNNN0MhfCEiy5F/51lR5X7OUxmWNfuDumcjZE9aK/Qvv/Ljr8U0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiwyOlrehs8Xq5TOXigJ3qKPE2QnCX2+lWyZLN8xkJlIKyPUuzvT0+30dgnOzkRu6J1wXo036y55XkzuyweRnp5ODHuzfCG3VAKqedVlhkBAYy5iqsQSJCWWdALDseD2UX3oIsV5SRSbMQu+D3j577zilYAmhk7yuCMUQwD7zl5K8DoxZQd35CsDzhTFgJPi5BE6HIyUylSpxmG1SH3LcYmduIIxVORGSFZvuAhORPsFqqxaF5rEDRLVo35hQySsF2/VhBtudBLjirCcdWUbJiqDG2N9cPRQrSD/yqmM+kCRex1E+RugNqZrnvNVG/IK1jTxNDJoohiIEJ1Z4aFFgQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 02 Aug 2023 09:48:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.08.2023 10:57, Nicola Vetrini wrote:
> The empty feature set 'str_7c1' in 'tools/misc/xen-cpuid.c' causes the
> struct declaration to have no named members, hence violating
> Rule 1.3:
> "There shall be no occurrence of undefined or critical unspecified behaviour"
> because it is forbidden by ISO/IEC 9899:1999(E), Section 6.7.2.1.7:
> "If the struct-declaration-list contains no named
> members, the behavior is undefined."
> 
> Given that Xen is using an undocumented GCC extension that specifies the
> behaviour upon defining a struct with no named member, this construct is
> well-defined and thus it is marked as safe.

Especially after realizing that I was wrong here (I was under the wrong
impression that we'd generate a struct without members, when it's one
without named members, yet [to me at least] only the former is a known
gcc extension we use), I've sent an alternative proposal. Let's see
whether in particular Andrew considers this acceptable.

Jan



 


Rackspace

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