From patchwork Thu Apr 20 15:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 675643 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp395086wrs; Thu, 20 Apr 2023 08:59:33 -0700 (PDT) X-Google-Smtp-Source: AKy350abfjPTrHFhvcal/PZCKmQyOUZuni14biXNWjQbY4Ta6wHlWwshDroXS1ulblUacmnTjbEU X-Received: by 2002:ac8:5d93:0:b0:3e2:4280:bc56 with SMTP id d19-20020ac85d93000000b003e24280bc56mr2893868qtx.41.1682006373773; Thu, 20 Apr 2023 08:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682006373; cv=none; d=google.com; s=arc-20160816; b=C1q4uLtC+uNK36MBwNHGnOVy10tudd4e+PiqeXU20re31wN2drAwPzep01tkYNioMm mtXLrYx7Qi6xOkfODe9XmipjkSTPtpqP9TweacZHMt8xPgWex6zgZHP8rSU1I+4OI30D 5eC435MU9Smq3e/m7FsQ9O+oMSoYfd80aDcUUasmEbqfnu3EZWTuM0wcynssOZC/7HWa PhxqUrPRk+ookxE5RX9uv+c5tINKH14/20sCMgpFo87SFVzUjasIpKX7XajbwBuasJsV 6do8uCPTobMPjEH57hnVXv7NVcl/16IoroeoWGHqUO6bRk3G8OlqYsj1sewSpTMDGQxD KBlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Nrpom6SU9io6Y3gUibz5mchgZ9rlSkFFImeDW90ONAA=; b=X8ad/0XGViNq5cfp1FgKCLEY/ZMh0C1AS8KEHQKl1xshJ6zR7ghaHO89ZdXCLS4HBq kkyC+IZ4iVq+ywxZK+T5Pofw1u7d/cnEyGb7XFv2GDWDUUO9PAdPN17teV17WRrXIHtk j9biH2XOxKYWT/s3SGnsKZspykN3vffhgRTyHIFDZWChfEx9rmj5RdVuM/w/mAnOjNos VI6rI7mqyAa/PdJv9/YOWHveTj0Xj6bzDPqgR/7y38++qLDtEm6MpBgZE/rZdOJgoUQ5 znulxx/wIS6g6nv5aG80M3VZoWlJs16kDQ7wqv+fTZeWTe1YsJHbNpasy3+VJmCVUROU Z40Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XcIhGUNa; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b9-20020a05620a0f8900b0074698b29c54si1242599qkn.503.2023.04.20.08.59.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 08:59:33 -0700 (PDT) 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=XcIhGUNa; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppWf6-0000By-VO; Thu, 20 Apr 2023 11:57:32 -0400 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 1ppWf6-0000BO-5E for qemu-devel@nongnu.org; Thu, 20 Apr 2023 11:57:32 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppWf4-0007um-Jo for qemu-devel@nongnu.org; Thu, 20 Apr 2023 11:57:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id a8-20020a05600c348800b003f17ddb04e3so1380975wmq.2 for ; Thu, 20 Apr 2023 08:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682006247; x=1684598247; 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=Nrpom6SU9io6Y3gUibz5mchgZ9rlSkFFImeDW90ONAA=; b=XcIhGUNaOemHzy+nxsyl+p9N4Z1KraBOcUHw3ogTymi2TmBfHdES6IOO3dokbYRz7A KOJV5Qhf9tEH5baUAfmyVY/eVGLQCsTZWkkxCbG950IiprLOCP/PXMot3tz5gaCq3m9b fB+/dq9/WsXHgzr3pET69BHHVSAOw4xGHlACvTo4aGF2EjRCf3NuWKjkaccwG8VFQby6 pCJqi1myWQHblE2BlIBpAvVdzfzKAIuArTeVlOtPYV83g3m0bqq0DOEdYfanmMxgt0Fq 9gxpRtWQasqoQJzaWGQizXghm29DqK35DJYtjaOoQBUe+rVOhMVc87gNDNGz0zkI+hzu 4pKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682006247; x=1684598247; 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=Nrpom6SU9io6Y3gUibz5mchgZ9rlSkFFImeDW90ONAA=; b=UbmMkyowBYdplnW9Gys2Jm9rBkZLa8yzVNF7ZUd8Zwy76wicThpdQzg+J9wKzEjkh8 VdzCSGHhvskAp60J/bmjPx719nUs4FVeh+z7I2n4XRL/XwvkYOVlMyrvTQDwPPjlGltI UqOVMAvx1rBnTtDKiSuo3OCOHRRlwa0HcKVNpLZn0hdbVL1DRipUOMIptw2ZIjWfl9X/ CgipClQRo1urjWKDyt/tAneo3e5Y0bbrybTEJqXcqekh561XaPN/L8vxFZ+KfW3xnPnK CgqWLugD1WZTjRSw54EUcoviCINoYBkWaCKagUFIRBVO7HZlWOTw1C3QA3TsZDZ4Zp90 aArw== X-Gm-Message-State: AAQBX9cIh7fwJHS6WtF21jtZtdyKUB+y2gOYDbTnE26hwpEkKG5ftepU khLJRwywr/eT0bDsyHhFc0TE2g== X-Received: by 2002:a05:600c:258:b0:3f1:735b:9c4b with SMTP id 24-20020a05600c025800b003f1735b9c4bmr1768256wmj.37.1682006247508; Thu, 20 Apr 2023 08:57:27 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h16-20020a05600c315000b003f173a2b2f6sm5828196wmo.12.2023.04.20.08.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 08:57:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3617E1FFBF; Thu, 20 Apr 2023 16:57:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Elena Ufimtseva , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P?= =?utf-8?q?=2E_Berrang=C3=A9?= , peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Thomas Huth , Markus Armbruster , Alexandre Iooss , John G Johnson , Jagannathan Raman , Juan Quintela , Eduardo Habkost , Richard Henderson , Mahmoud Mandour Subject: [PATCH 7/9] docs/devel: make a statement about includes Date: Thu, 20 Apr 2023 16:57:21 +0100 Message-Id: <20230420155723.1711048-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420155723.1711048-1-alex.bennee@linaro.org> References: <20230420155723.1711048-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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 While not explicitly disallowing header macro abuse (because that would make us hypocrites) lets at least address some things to think about. Signed-off-by: Alex Bennée Reviewed-by: Juan Quintela --- docs/devel/style.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 68aa776930..5bc6f2f095 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -300,6 +300,20 @@ putting those into qemu/typedefs.h instead of including the header. Cyclic inclusion is forbidden. +Generative Includes +------------------- + +QEMU makes fairly extensive use of the macro pre-processor to +instantiate multiple similar functions. While such abuse of the macro +processor isn't discouraged it can make debugging and code navigation +harder. You should consider carefully if the same effect can be +achieved by making it easy for the compiler to constant fold or using +python scripting to generate grep friendly code. + +If you do use template header files they should be named with the +``.c.inc`` or ``.h.inc`` suffix to make it clear they are being +included for expansion. + C types =======