From patchwork Thu Apr 27 15:45:08 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: 677532 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp418613wrs; Thu, 27 Apr 2023 08:55:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Rhw4OylVg8CkR6GePNLuXeLYKR2jCdxr2PIugfCOa+sW1G+nScXrqS2KyhMPnraYuP4tC X-Received: by 2002:ad4:5748:0:b0:616:4da9:9ade with SMTP id q8-20020ad45748000000b006164da99ademr2831264qvx.42.1682610920833; Thu, 27 Apr 2023 08:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682610920; cv=none; d=google.com; s=arc-20160816; b=ZWqucq6krZ81CbcUSBPEvsJH1M6CX5M6m3S9CDSa+1XFxTANwAAnLLcQiVzGDpxN73 jCN+V+/ryevQ4SHwAmcIUEGaVDdqbOC2fQgComoLiky7U/ahLF1aTsULYo3AmOD0NZ/O rdjzG7j/r/6KkEaMOV9KJY1JOa/68ombSMbG6KFnLi4Vxt90N6AYjufsl7uSQ8vPXyOu /4Pu2eDkdQV9rmY2t6nGN5Wx94UasPFjSsoBcYlIZByhfTXsKJ8+gpjRro+0dE/FVrem YRYEk5OtB7P85nypT3VemA6t58kkgCFFii8wat4Bm+yWP7Qu+R9Gq6uDL20OR+mpSWJ9 zxHQ== 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=V2IcmnDRTfsJw8B/y7QWIsoARNTmJ+ae9LSsjB/DsJA=; b=i3WQEddKPmzwUFr1MfYJ2TqLO2uXrHieU+oA9uRn7XHD8H6dmabsXiFwgo8cAyZd+U LJfMDp1qA53MsvjfTvb8aukVgLGFvvwa0qdhlvXguDQL6I5fISzvCb2KzSFNazI2efKJ I3BXsJrahV2lumnCTPnOPxIrUMFnvJGwI4V5xp1ykr4X91jumfbD4zFGraucWJhqZRgm XS0h92AmcN0oGKa6yZvmtE67JyvX5PmzhPuZPGek8gFUax+mpRbaI9q81ZUMarb0ZCb1 8d1oKcie0QgCQCJbH+TsprZ5vhH+Ae3JT+3xDEg8u86yuQQiGME49zhok2WxLO8Lq+p+ SlOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T54RLeVP; 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 jf5-20020a0562142a4500b005f16b22c150si12299743qvb.172.2023.04.27.08.55.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Apr 2023 08:55:20 -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=T54RLeVP; 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 1ps3wv-0007mM-Et; Thu, 27 Apr 2023 11:54:25 -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 1ps3wu-0007lv-5D for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:54:24 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ps3ws-0006mG-FA for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:54:23 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f315735514so29465495e9.1 for ; Thu, 27 Apr 2023 08:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682610861; x=1685202861; 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=V2IcmnDRTfsJw8B/y7QWIsoARNTmJ+ae9LSsjB/DsJA=; b=T54RLeVP8lSUZPkyiIxzY6nJJDW3uihdsUps3EkpTGKw029mj5KgJvBAMY5hJiOK9G 9lrOfeUW8MqtqiHQNleEYKU26ptIv2Aaf0bY14R9RlgmhlXCoQCSoCrM5tK3+grmSpvv J/aKUD7NLnfXb0jfWvWGnP1GcaFFkDEsMl4qbyCGwdjGHWXJY23ukmgGJgAEIbOmOBWO j9IluvjCEo3melLVhAXGNVH+Tjaxs7ZRwlzpaQh5Hbd3Sfzk85uhtYj3ZaehkQhgngbA zAzAL05J5PXjQZBFnR9rlw4JTsYU2K6CJASWNx+zscKcBdL04rjPS6H+DecJGDR2RUog +42w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682610861; x=1685202861; 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=V2IcmnDRTfsJw8B/y7QWIsoARNTmJ+ae9LSsjB/DsJA=; b=HR6a3DviC+js0ERsIL24SXMZ3b/6B0dp2aVEDwL7p9d1zq7SUbQDRE2zLlm3Qnbse2 uMGqMHW8YvWFZyeHmX1IBTS73y+orbwUp0DiNXDmI5X79DeJkim7rIRdrvtSFje7yVLG 3j7ugXJfQqfafzUfiwOvW22fxwJJFakjeXusg9OBHeMlWf4QAnWzas+XVoSUbo5e60oS soon7XsS0s0FpU0ZkkI0MOlRbdXOXVld39SK1wOvQT42Cy+JuRtjRf+fIRsupjX10/Qb hWdKguvrpzydHconLB+3ZBJvVHfanps+7RhtzMDIGRenNDbYgmdN/mBkk26CD/DBnjRT qCkQ== X-Gm-Message-State: AC+VfDy6AeQp30H0cAtp2mba5vGAsxYCZ7NqVdZGJONYRsKg/pEpf+rI Zd4j5SJjYSbjVDqbqSadg91NGq9r4X7+kneyvDY= X-Received: by 2002:a05:600c:916:b0:3f1:7371:86bb with SMTP id m22-20020a05600c091600b003f1737186bbmr4278089wmp.20.1682610860985; Thu, 27 Apr 2023 08:54:20 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id w23-20020a05600c099700b003f17af4c4e0sm24937769wmp.9.2023.04.27.08.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:54:20 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5E7F81FFC5; Thu, 27 Apr 2023 16:45:12 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Juan Quintela , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 16/18] docs/devel: make a statement about includes Date: Thu, 27 Apr 2023 16:45:08 +0100 Message-Id: <20230427154510.1791273-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427154510.1791273-1-alex.bennee@linaro.org> References: <20230427154510.1791273-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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 Message-Id: <20230424092249.58552-17-alex.bennee@linaro.org> 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 =======