From patchwork Mon Dec 26 21:04:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonny Grant X-Patchwork-Id: 62421 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 775C73858D3C for ; Mon, 26 Dec 2022 21:04:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id BB91E3858D32 for ; Mon, 26 Dec 2022 21:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB91E3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org Received: by mail-wr1-x42c.google.com with SMTP id o5so10890340wrm.1 for ; Mon, 26 Dec 2022 13:04:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=hidTrzh7J/1/Fn+POjPTRl5WhTM2oLI3DxRwMwwgV1Q=; b=Z+uH39+m80zpr3aqdeV4Hihck/Q15u8QGHoG2wNoGwKbSOf2cRrDOpxTV5Rr9FQYM1 pP3nNr57eMEX8KOmg/SOjc+u0idHjE+pgG9HACF0szaJk4qvh9kvemzYpCIp8kHVtJGi 6Fn7hoK2IBhmw5ZU6I03MQruxtC1d9eVDAIUKHiO/iDaevmT0j7a2E/uzOv+BTBASmRa hgkwe8evfrZfxnZhkGgezRUDjO9esGss2ornMcDuQmJ5efu3lJHFePgGgdnx5liKcirv +B8yQWtIOGolAVl/3UGZ4HgOYAXCGCmHyE+4tpnQX7FGj4zCEZ2wZfanKbRXMyH0Lyd9 PNxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hidTrzh7J/1/Fn+POjPTRl5WhTM2oLI3DxRwMwwgV1Q=; b=JQtOeEJc9+HZV9C3x0Q4DXU0B5PlMlidX12bkXmWxi4h5z+5rFI4JO7lHDIFhVffkH I9Ys4OZ/F2ciKaZfjtbMcHL+Ck3Ns41LdKL5Z+uQ7uTY8OKH9doKkGLansfNDA7z6XAj oRFWUoXAP4It7/IqYMvxn2O/WFDW1eT3nSVmvP9NZqlqYELV/FVm6MzrsNVRm22oMeYF P5mLIEExOx7pFJ7QWQoBPxrLHOokw4+p05DcQEr6EYlmx5HBsJCJrBg+x2Ef1gpbYdg9 cFkA96HMw1qJdvkCto/r8nnz4UeCEjGyCeb6VyN+hPRChpWlqhTqCdA7JC4AZivs+7IH Y4BQ== X-Gm-Message-State: AFqh2koIoRy1et+qLeuo5nl53PjDJoL6SMTmvyeeViIZjRPkmYCewvF5 UupB0nUmmPY16h6JXRqcM1yzu3R8wLT6moG6 X-Google-Smtp-Source: AMrXdXtGqbk6nqRzenmBFQk4iTC+3SF/OXKHLJI0CGZ30Hf4AAuqBxMkYZawNxwSe5yUFXhr3kF69A== X-Received: by 2002:adf:e383:0:b0:255:300d:79c7 with SMTP id e3-20020adfe383000000b00255300d79c7mr12945050wrm.18.1672088672503; Mon, 26 Dec 2022 13:04:32 -0800 (PST) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id w17-20020a5d5451000000b0023662d97130sm11168126wrv.20.2022.12.26.13.04.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Dec 2022 13:04:32 -0800 (PST) Message-ID: <750917f3-555a-a5b8-9d55-261b0883153f@jguk.org> Date: Mon, 26 Dec 2022 21:04:31 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-GB To: gcc-patches@gcc.gnu.org From: Jonny Grant Subject: Bugzilla 88860 - Clarify gcc online manual attribute format printf example X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 2022-12-26 Jonathan Grant * gcc/doc/extend.texi: Bugzilla 88860 - Add attribute format printf example From 1668dc58206428ee92ff142bafb5f545dba029ae Mon Sep 17 00:00:00 2001 From: Jonathan Grant Date: Mon, 26 Dec 2022 21:02:35 +0000 Subject: [PATCH] Bugzilla 88860 - Clarify gcc online manual attribute format printf example Signed-off-by: Jonathan Grant --- gcc/doc/extend.texi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 88fc625050b..9b200c6f3a0 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9353,6 +9353,13 @@ __attribute__((noreturn)) void d0 (void), the @code{noreturn} attribute applies to all the functions declared; the @code{format} attribute only applies to @code{d1}. +@noindent +The following __attribute__ causes gcc to check run printf argument checks on argument '3' which is 'const char * string format' (when visible at compile time), against argument '4' the '...' variadic ellipsis. In the example below, arguments '1' and '2' are not checked. + +@smallexample +void string_format(const char * prefix, size_t line, const char * const format, ...) __attribute__ ((format (printf,3,4))); +@end smallexample + An attribute specifier list may appear immediately before the comma, @code{=} or semicolon terminating the declaration of an identifier other than a function definition. Such attribute specifiers apply