From patchwork Wed Jan 12 11:27:15 2022 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: 531587 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp4325947imp; Wed, 12 Jan 2022 04:13:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/zaAd55i90ZRqkQbXdDH1DiHe/FvFNQDZHqg7cx+CIX17K21q0CXUJm5jVBEIRzM31pTS X-Received: by 2002:a25:a2cb:: with SMTP id c11mr8897810ybn.363.1641989581361; Wed, 12 Jan 2022 04:13:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641989581; cv=none; d=google.com; s=arc-20160816; b=IRcsr0XK0Ek8s2oWr7uxfakXAWsLa11F/Kc6B+DfPefTY8syx1TNiNCl5nswBWFOqG jX7vnMKInR6IFSbNpfolGpPHg4yk6RL78MJ3PyGxdvqO4NwaTjHC6IAj0eOaiL3LXm5t /kkE4XqNyr5/v8OBhbWx+4yY/R7wC3FdKBEIz3rTHznhCjRZx7Zs0jcV3eTwNxJwRScH ixohMIo+nnZZ8I/mIQopxPPkOFBx8zTHyO9inmgFyWB/0/vUETWZrH7x2BaUO8XqBGBD CqFC9eFT3UJ4ecPN2GQ06Ti+mJNZyftDd0toEBtFYIaB46/OWFq2HazvVFr1KTiCTOmY py2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=RgR++mzd4nHAJ0qj6nm77nGNzlG5e04+4pukBUPNhbY=; b=05n3Ll8NFfyEcpVi/G1Bm9xn5k00fAPFAS9uEWYcrVh7/w88rqgYE6445mmsxLWtk1 RhGbbGdbzyjHNzWtZwS/6BbBUPhtkWE23T7s/xNcvV3DdfluPXWtJba95ixT4qBlSJsw TR8RjwQpQ10JJ8/ugK7o7wrJZOgQT4r/x7lrKVzoUsQhq+JaDNeY/+5W7T+fHpuqt/ux f13GbepV408fdQ/CGEfbLZMkqKkUGZ1pPUNJdIbT48P3XbQps+YGKI535v2s5EMhMam5 QIloCuRgDvIZic5qlGQ/cDe7kD0mVanLn0UT3DahMDI0+MiqqWg0fyylkN5MaChOOBpw ZBQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QeqPI2r/"; 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=fail (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 e3si12084135ybi.812.2022.01.12.04.13.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Jan 2022 04:13:01 -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=fail header.i=@linaro.org header.s=google header.b="QeqPI2r/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7cUu-00072R-A9 for patch@linaro.org; Wed, 12 Jan 2022 07:13:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7c50-0003Vz-1t for qemu-devel@nongnu.org; Wed, 12 Jan 2022 06:46:14 -0500 Received: from [2607:f8b0:4864:20::934] (port=33620 helo=mail-ua1-x934.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7c4y-0006I5-Cw for qemu-devel@nongnu.org; Wed, 12 Jan 2022 06:46:13 -0500 Received: by mail-ua1-x934.google.com with SMTP id u6so4297797uaq.0 for ; Wed, 12 Jan 2022 03:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RgR++mzd4nHAJ0qj6nm77nGNzlG5e04+4pukBUPNhbY=; b=QeqPI2r/ltKfk46mmxxBWDmUH4pmY9BmWpP98B1qHUBlqH1h3t4cmQ6Qb1QCCV7tzO GVsOmHELZsDg7q8T4jBivkC68vLHodS9jwDZCnZiV6h+vPqQn0MMwD7YW0M2tzlO4hmK 3Iw2k+O2+6YkD8EWkEVfVcShk1CNTWiFcgJIk/tE8XHgUViRduY4qTPtwGniD1J4qVsl q4Bk60En8aITh7udtuRAqrQ9t7KFG+5b7JFgThZZ9WaW/uyXCC6rkSjogOzFoiZaBx8Y FNo/r9vDPuZUWB8aQrPkoX5z9uKrEppCb4lZl1WbjWFWKaWJpmetkCd2kttRXSKxcWfT vOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RgR++mzd4nHAJ0qj6nm77nGNzlG5e04+4pukBUPNhbY=; b=rH1eKfi++5E/bN4Al7K0i3hVHQj7faRh6yBq6ahwHboKIHnhCz0Tmu2/iTXcRun0fA UFeak2bSMIf282VTBy2TGV65XpVciRYB5c2DWkaQvQCp5GFZlBab0Znrj4MSWMrKFWB4 hxyME9K0jFF9cAhA49227vRnbsjEaFnLADKXJkABXZ0f8ZU6K9QAuTSj+I/CMuZadzBo Rt8QxxNydNu7yY2KnDjKHb5WweaiNCmv7quEFQ4glKX/BQPyccby4SmY2RBNExJgG+bj 93eGT9jPvnh1k3GUybTYBtFHICc3Zde1248R278jgp4pZtID0Occ4Qh5eRTLzD6qBY5V k5tw== X-Gm-Message-State: AOAM531KzaBKGb56BfWJciblG7+b2KJViCJD0r6meD+4YeLY826e8uo1 Y8MN71pNaSXWXKaYneeUL0NQlw== X-Received: by 2002:a05:6102:2279:: with SMTP id v25mr2407962vsd.22.1641987971402; Wed, 12 Jan 2022 03:46:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j27sm7301361vkl.52.2022.01.12.03.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 03:46:10 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7BBDD1FFD0; Wed, 12 Jan 2022 11:27:24 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 24/31] docs/devel: more documentation on the use of suffixes Date: Wed, 12 Jan 2022 11:27:15 +0000 Message-Id: <20220112112722.3641051-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220112112722.3641051-1-alex.bennee@linaro.org> References: <20220112112722.3641051-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::934 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::934; envelope-from=alex.bennee@linaro.org; helo=mail-ua1-x934.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Using _qemu is a little confusing. Let's use _compat for these sorts of things. We should also mention _impl which is another common suffix in the code base. Signed-off-by: Alex Bennée Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220105135009.1584676-25-alex.bennee@linaro.org> diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 4f770002a7..793a8d4280 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -151,6 +151,12 @@ If there are two versions of a function to be called with or without a lock held, the function that expects the lock to be already held usually uses the suffix ``_locked``. +If a function is a shim designed to deal with compatibility +workarounds we use the suffix ``_compat``. These are generally not +called directly and aliased to the plain function name via the +pre-processor. Another common suffix is ``_impl``; it is used for the +concrete implementation of a function that will not be called +directly, but rather through a macro or an inline function. Block structure =============== diff --git a/include/glib-compat.h b/include/glib-compat.h index 8d01a8c01f..3113a7d2af 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -46,9 +46,9 @@ * int g_foo(const char *wibble) * * We must define a static inline function with the same signature that does - * what we need, but with a "_qemu" suffix e.g. + * what we need, but with a "_compat" suffix e.g. * - * static inline void g_foo_qemu(const char *wibble) + * static inline void g_foo_compat(const char *wibble) * { * #if GLIB_CHECK_VERSION(X, Y, 0) * g_foo(wibble) @@ -61,7 +61,7 @@ * ensuring this wrapper function impl doesn't trigger the compiler warning * about using too new glib APIs. Finally we can do * - * #define g_foo(a) g_foo_qemu(a) + * #define g_foo(a) g_foo_compat(a) * * So now the code elsewhere in QEMU, which *does* have the * -Wdeprecated-declarations warning active, can call g_foo(...) as normal,