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

Re: [XEN PATCH] docs/misra: document the C dialect and translation toolchain assumptions.


  • To: Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 19 Jun 2023 09:54:34 +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=Nv6eeySf1eJE47qwUYLN0zpNzhCE+Fc+xp/3uSNMKnQ=; b=GOejnxFGYa43IGT2ISKHxif1lnD+397Dj//L5TIqtGE9P+Uo7wPaDrI23LVMTXDZxTtYzplWL/Gz7jJgI0AD6swgnRYVuSzodRErzyPF3Z0XL+Q3Y7s/y/7r9F5VNRCo6tmXT8MNXrm+PlMbeL53hLC1l2UcfWYmWq92xddm3kE8xQv/3ecAYsbVdke3+2gT0U3fQn4RDDpLIr6MLOJdAHTTXIeMBRCsQm2usJim3q1tkcOaV0sduOUT+FDH3uDCTvxTmWB1AzqB1f+Tv9FvwhWG51MAlPCpSXBbB010O2TqeoMh0jzPMQeq7J8DML7cmBjSoPc9Z4rlDAhcPRvNaA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaQQKWoL1B/PDxzGOHXgYH/F54Fu1EJ04pQpkJBlBKuY2jrRIarlw1jOKpZ+VqYj27tyYSBE29v9ddnLP8IQNmP9YL1trLCBcQzqiST5uBjrn9SetTS7Ae3cOWKPhL5JZcF+9U5oRbE55PYKOnO99+XGDEuUm6meSB6v+jViM83YK3a2fvUqQjmPbnIev36Mb9ct3tiruPUTFnVHbBcXsWsFxL0aS+elHqj8KKYyqL5SOzkyLaMcf5takl5MohRKTQZtO3hwXeytzWH7WfdNvh+UXPN4HZiwUWDOS3hIxcuIvg6/Q2CbL16i9Y4LPunb3PyVgjeUYeKg/+ElFuK9FA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 19 Jun 2023 07:54:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.06.2023 17:54, Roberto Bagnara wrote:
> On 16/06/23 01:26, Stefano Stabellini wrote:
>> On Thu, 15 Jun 2023, Roberto Bagnara wrote:
>>> +          see the documentation for -Wreturn-type in Section "3.8 Options 
>>> to Request or Suppress Warnings" of GCC_MANUAL.
>>> +       use of GNU statement expression extension from macro expansion:
>>> +          see Section "6.1 Statements and Declarations in Expressions" of 
>>> GCC_MANUAL.
>>> +       invalid application of sizeof to a void type:
>>> +          see Section "6.24 Arithmetic on void- and Function-Pointers" of 
>>> GCC_MANUAL.
>>> +       redeclaration of already-defined enum is a GNU extension:
>>> +          see Section "6.49 Incomplete enum Types" of GCC_MANUAL.
>>> +       static function is used in an inline function with external linkage:
>>> +          non-documented GCC extension.
>>
>> I am not sure if I follow about this one. Did you mean "static is used
>> in an inline function with external linkage" ?
> 
> An inline function with external linkage can be inlined everywhere.
> If that calls a static functions, which is not available everywhere,
> the behavior is not defined.

I guess I could do with an example where this leads to UB. What I'd expect
is that it leads to a compilation error.

>>> +   * - Unspecified escape sequence is encountered in a character constant 
>>> or a string literal token
>>> +     - X86_64
>>> +     - \\m:
>>> +          non-documented GCC extension.
>>
>> Are you saying that we are using \m and \m is not allowed by the C
>> standard?
> 
> The C standard does not specify that escape sequence, so what is
> done with it, in particular by the preprocessor, is not specified.

Isn't it rather that gcc doesn't follow the spec to the word here?
As per what preprocessing-token can be, anything that isn't (among
other things) a string-literal or a character-constants falls under
"each non-white-space character that cannot be one of the above".
Hence since "\mode" doesn't form a valid string literal, it would
need to become (using '' notation for separation purposes, not to
indicate character constants) '"' '\' 'mode'. Which of course would
break what subsequently are string literals, as the supposedly
closing double-quote would now be an opening one. Which in turn is
presumably the reason why gcc (and probably other compilers as well)
behaves the way it does.

Jan



 


Rackspace

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