From patchwork Mon Apr 24 09:22:47 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: 676570 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2056863wrs; Mon, 24 Apr 2023 02:31:02 -0700 (PDT) X-Google-Smtp-Source: AKy350bzgHrNV/LjXV0uQ/0PT8r1pjJyWbozW8MgSLzXP1I0YdaebRmcQ63RjWeV9Mp4sfgILPA1 X-Received: by 2002:ad4:5de2:0:b0:5eb:fc42:ea4f with SMTP id jn2-20020ad45de2000000b005ebfc42ea4fmr19131487qvb.33.1682328662142; Mon, 24 Apr 2023 02:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682328662; cv=none; d=google.com; s=arc-20160816; b=N5G83tNRb8w/U9wD7WrOj0Pl6M1Xr6F6E0w6YtS3Nbl0SLKZIQ/bQHn54+XczrAJHD 6LiJ2hiCZe0XLyacqAODEZhFWYK5X7seZVwL0fnbCzh2EWGyelwLPOjzEMQsFrWKwaT7 KibF/C8+fke05NofhsRDvo9B6enGJ5OQ8GpzxkykKGFUFV4L072mm8TcxJN16mGrwjQT Z31nroDTtEerrqsSiq8xWY3XGQzlcr2ldss4mvkaIuSUYiUUJdr2eA0spoo1YUz3fkBx sAEuZM1xBMBYGfbIpk+a74x9yDv0Tukcr+0QZMsidYu+dRatC4ObAfKzMarT4OjVvfmt VPgA== 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=KZgFhfTtj2ImggRREYrxhpwQ3q5LfEc+IwV3JjKE3es=; b=bE0e9Vr6ZY7hyxD/p6IgWx7A7xvhV0sON2X+431gMg1y/PSAvB7gcTojCknYR0DHVE sL7TLUN6dK6YO3pEEzFr4IiO71Uo96hIj8G63NsnSKvpGe15R4DgbP5XWD2XGV7sqWDr YmF4nEjpx3LVL/PCugojjnQA7h58gZVFMH8hS1PmTUzeIgLs4LMiW3tmlBhgYB3GNMef Hdj9ApfqzRjUG5bxS27sS8FCANGQKGMRJozCSs/jlZswXI3wnow82qqs8uSR89YWTvlW ybrGBQndkgmaXWA3SIx9iVxMegCJ6ApuZI/apYL4qapy13oAErpOFPAVAg7yXHSQr6/x kYIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YoHXJyTX; 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 p4-20020a05620a056400b0074ac8afc0casi5493013qkp.1.2023.04.24.02.31.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 02:31:02 -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=YoHXJyTX; 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 1pqsWQ-0004IR-G5; Mon, 24 Apr 2023 05:30:12 -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 1pqsVr-0003wZ-5S for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:29:37 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqsVh-0006c4-0E for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:29:32 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-2f87c5b4635so3814086f8f.1 for ; Mon, 24 Apr 2023 02:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682328560; x=1684920560; 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=KZgFhfTtj2ImggRREYrxhpwQ3q5LfEc+IwV3JjKE3es=; b=YoHXJyTXBLh66AKNwBrJIHCyO5HhkmWA2vTLeHJFL6MeKV5saOk+RdLFuoKF2unXET ggWa+Mz3afLpqnsc2iK0h+EnvejTZk/99rz6SOhhzwKdyFsmwCoK0XR5lFzGDtLRZaZO 3dO13kgjX1t4FoqY9aCNTLVhgM7PWXLoWMOwK1FK6HEpl26n4A+4Jbxez7QuCWuaREIS 33B2kZ6Dh/DXuA/+eS1BwxN+h6qwEdEIg9QMXJbNXpA3Welut4CG/lPJ0U796c8GlkbD r66QpUBKCjS+I7n+SglWr336alW7Rwf3ocjxuXgWZsqFIJpDLBDdNxeRy6Zr276wZ8Sx T5Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682328560; x=1684920560; 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=KZgFhfTtj2ImggRREYrxhpwQ3q5LfEc+IwV3JjKE3es=; b=JmjWB5HpiGM+yt5j3R8ybJZRR7Cg6Rja0s8+LJcLlVfS9qrGHcWKrjPJXIuaCGG6Be XUVTjRAr8qFwFA7I0+cc35FBYIsmj9kPXjzdwmzb7t7AZBEUney0AiHUH9RH6yc8Z4JF 3lxuDaDCwrMnJYXK+IvY3rUCRODr57Kf500C0BzypF0SHE9GVv+Nt2FuRdTqjejZ+hZU 5u3GjgFZ973JkWfDOag9utNLUa5IZcPm1Vcrn+nzYov6W49Oad3B2o7zVeWVOLoDZbT6 QVnqUfCGOAAE2hkvzf56w0AVgFrDVy1kw8kYLEbI/EGcz3d0EAzrIb2M948/XP4AgX18 eL+w== X-Gm-Message-State: AAQBX9e4/XqXCEv7hRbOPZsc9c/gUvQfzqXUGAkAwwY4zPiKDjTxj5zI IWlCRSrttt4Qx6xHmeRjFbW1gQ== X-Received: by 2002:adf:ea46:0:b0:2e5:31a3:38d4 with SMTP id j6-20020adfea46000000b002e531a338d4mr9218447wrn.55.1682328560215; Mon, 24 Apr 2023 02:29:20 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j3-20020a5d5643000000b002e4cd2ec5c7sm10337523wrw.86.2023.04.24.02.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 02:29:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 543721FFC6; Mon, 24 Apr 2023 10:22:51 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Beraldo Leal , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , "Edgar E. Iglesias" , Paolo Bonzini , Aurelien Jarno , Peter Maydell , Juan Quintela , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , Joel Stanley , Leif Lindholm , Markus Armbruster , Radoslaw Biernacki , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , John Snow , Andrew Jeffery , David Hildenbrand , Bastian Koppelmann , Max Filippov , qemu-s390x@nongnu.org, Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Eduardo Habkost , Ilya Leoshkevich Subject: [PATCH 16/18] docs/devel: make a statement about includes Date: Mon, 24 Apr 2023 10:22:47 +0100 Message-Id: <20230424092249.58552-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424092249.58552-1-alex.bennee@linaro.org> References: <20230424092249.58552-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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 Message-Id: <20230420155723.1711048-8-alex.bennee@linaro.org> --- 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 =======