From patchwork Tue Nov 26 21:17:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 845618 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp460242wru; Tue, 26 Nov 2024 13:18:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVehatKB83UUePAFVeKtVCDwHOjMpmHj5QdOm9Sbo8S9jguMs8q9XvotKnCt8onSHGYmJQAgQ==@linaro.org X-Google-Smtp-Source: AGHT+IFTa/+zqzrvKWJfbmPvyqe2d2YFafpX43g5spAqoE6wG1oPBEoMukoowoT9wHQ6VGxbWia1 X-Received: by 2002:a05:6122:17a5:b0:509:e80:3ed2 with SMTP id 71dfb90a1353d-51556aa8c82mr953813e0c.7.1732655938934; Tue, 26 Nov 2024 13:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732655938; cv=none; d=google.com; s=arc-20240605; b=cH54b9SdFY9snTYfs4AfGs3wHbamTJO7QEoREreWHRqVYIlZEKiVGIJRT92mYDSiWN MD9GX6PFPG+O948NkFJFPBLHYUNimLhOoyVShTsaQ1EBQmZH86ejMELvxqbBe9NZKtba EfBm80ujPzt0zhm09ydIzFbtOBGR70yLOjWRVC0BLgIVe7NSGqLoreaI+N3CQ8BsiKic olugOEABcEbBGGtT3x1gBzUheGxddy5mLBAxeHiynL/CEFNea3SITLNTgGe+xg+lY6tP USlCT9QZLgz0cZAjw4VWNrF87zFbToAlWPscxUTJ/ARXSWpWD++/+d+nTsx6XVeXwhFj vcjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; fh=Wl5FFhkP2+p5s9Jt2/9UUpf5mrHiqOccw0kBq0/IT2c=; b=ZysjjPEHq2xvi6sydK1IfR+Ii9jrLG8lpeEuC8HAAJZ5TApR5Zl3gZxcz9oYA/iGXN mBLWRsPJLe+qy29375dT/hgPgGf/RMa2NCqKvMpspE39Im+DbpPdeyIlts2AyaowOChO Ow9Ik0hvBkxfgAh3BsA8XgVYtRw4zHuW7eoVm++WDh+N0Qjzp0qB0oUipyONY8v2rjm2 vKyS8VBzrGvX5XDBUJzs4yDOzlf6MOkUBfaDX1AP/yoR6EDZ55T7I5m0qKKDIHu7bcGP OdR73LPEpXle8xhIkrzpVNDHMVvcHPxZyPu7ax0XcDddruIp/gF717RwZg9QmQykve9S ofBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXHjQ2jZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51544568388si1236674e0c.166.2024.11.26.13.18.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 13:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXHjQ2jZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG2wh-0001Vn-0x; Tue, 26 Nov 2024 16:18:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tG2wf-0001VD-Ek for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:05 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tG2wd-0001b1-SR for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:05 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7fc41dab8e3so1137320a12.3 for ; Tue, 26 Nov 2024 13:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732655882; x=1733260682; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; b=XXHjQ2jZtUpl1ahosr/fXlvZW8eXLI34jaSg+2V4tQ+WEakH+GQlggcLWV6H2ctdgK KVj8d8UaDaM4aCjgXeEZqSw+fjE9T+ipTdoiHCmBJmV/IFh3NbikoCZ1aqO4rxf+JDKP V3p536iRlCYolsVausdLRIMnNj746pFuqO4fWA+cpnJtAwVR0hKJDaNa2Jk2SycihW/O Xw/HNMLBdG4hv1HpQ17mThw0QdyYHSDXgCZV7zEexJym1iKm6wgki6q/3WtUtipyZ8ss lsQ0AUgzXWdj4wNA26/Z1ad/6HCzF92kC6uKQrgphSNcPVKOzUgWP4vKsZ8xyOGFeY8k S95A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732655882; x=1733260682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; b=SKzmjpQMPS++j1D1CYixg9jocAQJwAgQQZz4+Ij4tOCQ8uor5p+XjD8iRBeJw3fHsA xtHQ6ikmVWMhnq09I3rKW046r0vm5e3QvbEQStgdSclnrAc/3z2ue2/50Rk6/471BdI4 RXrgxwrHbeF+sayzDGYbD4COec7eKBoAW0Ciz7eAvjWP2HKqxSn0Mc91zuTicTnv7MS7 0vzSHezSDZt9PIf0h4ZmS+cRX3/j1K/ofAoCEyNT5Qv7CbpLir+kKfBPxTyw8LE0gNfw mUILYa9KnD/uGLOu/DNNxpbumsH9L+fQSz0yIJ7V75I8/BTlxkSzvdNDwRh1lZc6KlQo r4MQ== X-Gm-Message-State: AOJu0Yzbt5ZpxJLWPWGXvFYpiDfc8xxZGDsqOu2jGIXF/ofZhm5QVmMY izUkTo/UH0AdLAuZbTwpNaE1wHtPKo4QdqA885seifKLDCSA4uhFkuswAvwQfGxrrFh6omGQ9Mm vIqo= X-Gm-Gg: ASbGnctdlO0JzPAFQoi1ZaezPjj9a3mXj/DhChLrUn5cZYZn1SQd90KIcO+OU+Dj/kV 3Lo0dqVbzvDVsE3nZbBlMlO5A2TEaMF8bvU91DEQSZc1V4r/r+Z1xk9sBp4gsw65blH6D578yka 6hjTB4PBWZ6fcaeDagA6U/Xxoz1Q4wX4Dk2qyZeRRCYXu6soky/5kA3ViMc2Y0iKfLgoy00R5n2 wmG+mtcsxPuburRqHL40p8hFS4jXO59sv6vC55FCU6Z/BbKGd8vNLBm3E8r+09AFY3rtuu5jRA5 ottXMUmPnq7K0Q== X-Received: by 2002:a05:6a20:2451:b0:1dc:bdbd:9017 with SMTP id adf61e73a8af0-1e0e0b6c85amr1532603637.40.1732655882476; Tue, 26 Nov 2024 13:18:02 -0800 (PST) Received: from linaro.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724fd95ed01sm5811766b3a.8.2024.11.26.13.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 13:18:01 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Garzarella , "Michael S. Tsirkin" , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Markus Armbruster , Mahmoud Mandour , Paolo Bonzini , Alexandre Iooss Subject: [PATCH v2 2/3] docs/devel/style: add a section about bitfield, and disallow them for packed structures Date: Tue, 26 Nov 2024 13:17:35 -0800 Message-Id: <20241126211736.122285-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241126211736.122285-1-pierrick.bouvier@linaro.org> References: <20241126211736.122285-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Pierrick Bouvier --- docs/devel/style.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 2f68b500798..13cb1ef626b 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -416,6 +416,16 @@ definitions instead of typedefs in headers and function prototypes; this avoids problems with duplicated typedefs and reduces the need to include headers from other headers. +Bitfields +--------- + +C bitfields can be a cause of non-portability issues, especially under windows +where `MSVC has a different way to layout them than gcc +`_. +For this reason, we disallow usage of bitfields in packed structures. +For general usage, using bitfields should be proven to add significant benefits +regarding memory usage or usability. + Reserved namespaces in C and POSIX ----------------------------------