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: 36705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1090524wrt; Mon, 26 Dec 2022 13:05:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXtBv2n6qG60Rmenp2digdm4KmZ9bOsIYex7oywv7iYkqzVbabHKQx7k6j1G1YIn1KO0/bEN X-Received: by 2002:a17:907:7ba6:b0:7c0:cfb2:40bc with SMTP id ne38-20020a1709077ba600b007c0cfb240bcmr20518023ejc.15.1672088715318; Mon, 26 Dec 2022 13:05:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672088715; cv=none; d=google.com; s=arc-20160816; b=n97weykzzCg4p1kBlAliA8AVA6HYl9YqdtPxBPid6cUczOPzTFtXVE97+WHGsNNpwL 1M8GHjuwBHewHO48Qoo/S7++OadjwDKZfJ5ahb44LgScU6RRDptwz+K7qaeyp3ZP2RLe DPiRaTkfKkxvEHKpifZmwf8azIqXDTuRFIyLmXm/SRCvDpzavjJqa6sSrZwlFUWohW6J AEFyl/7ZNyLcJiabug4qbNq5YoKv5ukVxfnj2VaptNW+8pnRgwhrREI1Fgl3haX9N1Hk LHc8eR6XVE6iqfCAJY6wVLUQ0MEYN07PHaanlWc7cRpvBbGbHrxNPSDSKhRJOfdnZ5rV OTcg== 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 :subject:from:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dmarc-filter:delivered-to; bh=hidTrzh7J/1/Fn+POjPTRl5WhTM2oLI3DxRwMwwgV1Q=; b=FKlbhqz5h4yoJrxiNfylLKYVz///usWWFIYRZmf5svfGyP0wJfzNkJ2+yW7zTQMgrA Q8ggTFrgVTvdNZ5M0oEa1mA9GQcSfum+du3+baLkJayi3lLwcueoNkXvgVYBGAascX7o 4GzHGRB7KioQEunfrxydQIAi4KUzDoazIGoUeVrqKQSqRRsprAh/+j57TSj/d09IQSDI iqOGztG5DI1IFFKTIa1QdMogH3wIeCOgFRzaywNTr8YAGm+bZojhuYgYapwEIXK1AvSA 647B6ekwZMYIkAIuLskme2YIKs5qKaxGuRy1elhwJ1Rf5llUZFcfgc2laSaEUFriGeO6 MpcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jguk.org header.s=google header.b=Z+uH39+m; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id qk19-20020a1709077f9300b007ae4717bf08si9175237ejc.359.2022.12.26.13.05.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 13:05:15 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@jguk.org header.s=google header.b=Z+uH39+m; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A36733850F0F for ; Mon, 26 Dec 2022 21:04:59 +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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753312096723499277?= X-GMAIL-MSGID: =?utf-8?q?1753312096723499277?= 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