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

Re: Xen reliance on non-standard GCC features


  • To: Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 5 Jun 2023 14:39:49 +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=PDlS5i9qDdxyBoeXLh/A+o5m39neOrp7/yI508+YIg0=; b=WlSsbRzkTSdzkWd4BRUnETpV6w5gEAUOWa94nD615rIPiKMMUQAKB5Mffd0usbbJrEXVcBNToY6tVrG0QdT3+1cUGV8ysbIOK1hnUBAd3OwyoAzMau1m/CUiYmzFL106Td4hCwkpwsUohfto2Wy7cR+FWNgYQIHpv9erTk+VQwtlTgeZxJpmLtSyCx9IbqVkO/0Vvg0xLRaCG/OnHnR8hxYghDixmmnzkVQnzSnh83BWqX6GpgO5+2noowFLOb/tyYuL6QRzDs7nVrFEsE811eBpBm/FQzUPQshxlvIXlRdvHP068pOlsyMEjKVKHdGIWqHJ6lLgIWKCKiai1n4g/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Krm4NtJSmPVFD5GMlVIMjSLHur+QeNrupijNaC8/T7ztWA3nIY/WFZqOCdnduoVngjSztpaUVfm0WpospzRpiBrZoR0oRfNFRUfcMbo9TsRTtA7DCutmhREw7lVOUjQCDmHI9hg661wpqcZkX3FllTmMIzIFRtsonzJHg3Frs69vOC5IKIriDblwjojDwW95ZP0XJb65o1SGQnDUsoclaMJjSCUb/SNDQpzM2BTEK3qBAlTGv4Ui7HqyhomrVQlAQomTvNJ4IveiVsaM/4e1y0JCA4UJLnX5l0ctULR6qV4pUpEfL5sezy5OSvpvV2mmGYwCH7FCNy0KylEZ8iT8zA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 05 Jun 2023 12:40:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.06.2023 14:15, Roberto Bagnara wrote:
> On 05/06/23 10:58, Andrew Cooper wrote:
>> On 05/06/2023 6:28 am, Roberto Bagnara wrote:
>>> U10) \m escape sequence.
>>>       Is this an undocumented GCC extension or just a typo?
>>
>> Where are you seeing this?
>>
>> The only examples I see are in asm macros, and they're all parameter
>> substitutions.
>>
>> This includes the one in x86's bug.h where it's a parameter substitution
>> into an .ascii string literal, not an escaped special character in the
>> literal.
> 
> The point is that escape sequences must be considered for tokenization,
> which happens in translation phase 3, as they are relevant for phase 4,
> which is where preprocessing directives are processed and removed.

The C99 text mentions escape sequences the first time in phase 5, which
means string literals inside preprocessor conditionals which evaluated
to false were already removed. For tokenization all that should matter
is escaped double quotes (when determining the end of a string literal),
escaped single quotes (when processing character constants), and
escaped backslashes.

> See C99 Section "5.1.1.2 Translation phases" for the definition of the
> phases.  So \m is non-compliant even in areas guarded by
> 
> #if defined(__ASSEMBLY__)
> 
> and a conforming compiler should flag it.  On this, see footnote 65 to 
> 6.4.4.4p8,
> where the 'm' in '\m' is one of "any other character":
> 
>    65) The semantics of these characters were discussed in 5.2.2.
>        If any other character follows a backslash, the result is not a token
>        and a diagnostic is required. See ‘‘future language directions’’ 
> (6.11.4).
> 
> Kind regards,
> 
>     Roberto
> 
> P.S. Note on passing that the comments on the preprocessing directives
>       are a bit misleading due to the use of the exclamation mark
>       (IMHO "defined(__ASSEMBLY__)" would be better than "!__ASSEMBLY__"):
> 
> #ifndef __ASSEMBLY__
> 
> ...
> 
> #else  /* !__ASSEMBLY__ */
> 
> ...
> 
> #endif /* !__ASSEMBLY__ */

As long as these comments are unambiguous, I for one strictly prefer
the shorter form.

Jan



 


Rackspace

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