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

Re: [PATCH v2.5 3/3] xen/types: Rework stdint vs __{u,s}$N types


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 4 Jul 2023 16:38:43 +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=MuNhuMAqFMs1w6BxdSHXBrN+n65LvlYXXmD1XSEsnTA=; b=HVyjcapa7uK3PhrFUZfxTqOcv6igAfIeQdzQ+T5CzK/qVAlD28IHGNLSopgQLDcprlVTWXk2hv/ooG097wrXm9fN1qrkNmCbFTSwdHtHz1lsoDCpy1EGKks05Sr5U/gzhdiUrK9/e8gDBkNs/13/ZEMIG6oW+jCyM3WSwutXXdTxwkq93oYYF6CfICTrDwumHVpqE0vXWZp4fXVIgSeJrbNREplowwkTS6stsqaa+gZev+8Qzf/VY8po58a/E9c9gtVCAmv/K9aS/vg8KLu/AGRxeLOIkKdh1y1NTlcsXW5pjtP/j2iH89z/JHDfRvLFxC4H6BPDhxCIzDcYmHiQ3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gi8KVF04OZO9TAcimykRTgGSb1XdqstfXsNZeN2w/ZhdN84RjD4n/UBDO5yG4nRgpd2rWnEwBUGstJBVKgdd+zKIfaHHqEnP7tyZRUhfL5LhmltJUdxZTlyroe0rVHGc3cvgTMx7R2yQJGXEoQ/6+MC+6MCGcL6TXtIPCbt4ERSYR2DjB4cExkChWOsnXYwtaYkYOtZqxmPUyQAYXQVqzv7wqw/kZNmbNKvGBWF890osvZpj8f1aXxutiDunjXQdPrj6Ch9EMrMraoEKPdfDIjuKQyGXoXEUG7voK4tWPjJHqtKLWV/JDDhE4ED1TfiV+7IxUe2fAlyk3Uxxj6V8WQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 04 Jul 2023 14:38:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.06.2023 16:54, Andrew Cooper wrote:
> Xen uses the stdint types.  Rearrange the types headers to define the
> compatibility __{u,s}$N types in terms of the stdint types, not the other way
> around.
> 
> All supported compilers on architectures other than x86 support the stdint
> __*_TYPE__ macros.  Move these into a new xen/stdint.h to avoid them being
> duplicated in each architecture.  For the very old x86 compilers, synthesize
> suitable types using GCC internals.
> 
> This cleanup has the side effect of removing all use of the undocumented
> __signed__ GCC keyword.  This is a vestigial remnant of `gcc -traditional`
> mode for dialetcs of C prior to the introduction of the signed keyword.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with one further remark:

> --- /dev/null
> +++ b/xen/include/xen/stdint.h
> @@ -0,0 +1,33 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef __XEN_STDINT_H__
> +#define __XEN_STDINT_H__
> +
> +#ifndef __INT8_TYPE__ /* GCC <= 4.4 */
> +
> +/*
> + * Define the types using GCC internal notation.  Clang understands this too.
> + * https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
> + */
> +typedef   signed __attribute__((__mode__(QI)))     int8_t;
> +typedef unsigned __attribute__((__mode__(QI)))    uint8_t;
> +typedef   signed __attribute__((__mode__(HI)))    int16_t;
> +typedef unsigned __attribute__((__mode__(HI)))   uint16_t;
> +typedef   signed __attribute__((__mode__(SI)))    int32_t;
> +typedef unsigned __attribute__((__mode__(SI)))   uint32_t;
> +typedef   signed __attribute__((__mode__(DI)))    int64_t;
> +typedef unsigned __attribute__((__mode__(DI)))   uint64_t;

Much like you avoid "mode" potentially being the name of a visible macro,
the mode identifiers themselves could in principle be, too. Being upper
case names, perhaps there the risk is even slightly higher. Hence I'd
prefer if you/we could use __QI__ and alike.

Jan



 


Rackspace

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