public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Tomas Kalibera <tomas.kalibera@gmail.com>, gcc-patches@gcc.gnu.org
Cc: joseph@codesourcery.com, martin@martin.st, redi@gcc.gnu.org
Subject: Re: [PATCH] [12/11/10] Fix invalid format warnings on Windows
Date: Tue, 11 Jan 2022 14:37:36 +0100	[thread overview]
Message-ID: <466c29c3-54b1-5627-3d9d-e385ad037a4e@suse.cz> (raw)
In-Reply-To: <ae74c8a1-2268-76bd-2e9d-a11c2e1e46a0@gmail.com>

Hello.

I do support the patch, but I would ...

On 1/7/22 19:33, Tomas Kalibera wrote:
> +          if (is_attribute_p ("format", get_attribute_name (aa)) &&
> +              fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
> +            {
> +              switch (DECL_FUNCTION_CODE (fndecl))
> +            {
> +            case BUILT_IN_FSCANF:
> +            case BUILT_IN_PRINTF:
> +            case BUILT_IN_SCANF:
> +            case BUILT_IN_SNPRINTF:
> +            case BUILT_IN_SSCANF:
> +            case BUILT_IN_VFSCANF:
> +            case BUILT_IN_VPRINTF:
> +            case BUILT_IN_VSCANF:
> +            case BUILT_IN_VSNPRINTF:
> +            case BUILT_IN_VSSCANF:
> +            case BUILT_IN_DCGETTEXT:
> +            case BUILT_IN_DGETTEXT:
> +            case BUILT_IN_GETTEXT:
> +            case BUILT_IN_STRFMON:
> +            case BUILT_IN_STRFTIME:
> +            case BUILT_IN_SNPRINTF_CHK:
> +            case BUILT_IN_VSNPRINTF_CHK:
> +            case BUILT_IN_PRINTF_CHK:
> +            case BUILT_IN_VPRINTF_CHK:
> +              skipped_default_format = 1;
> +              break;
> +            default:
> +              break;
> +            }
> +            }

... skip this as the listed functions are only these that have defined ATTR_FORMAT_*:

$ grep ATTR_FORMAT gcc/builtins.def
DEF_LIB_BUILTIN        (BUILT_IN_FSCANF, "fscanf", BT_FN_INT_FILEPTR_CONST_STRING_VAR, ATTR_FORMAT_SCANF_2_3)
DEF_LIB_BUILTIN        (BUILT_IN_PRINTF, "printf", BT_FN_INT_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_1_2)
DEF_LIB_BUILTIN        (BUILT_IN_SCANF, "scanf", BT_FN_INT_CONST_STRING_VAR, ATTR_FORMAT_SCANF_1_2)
DEF_C99_BUILTIN        (BUILT_IN_SNPRINTF, "snprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_3_4)
DEF_LIB_BUILTIN        (BUILT_IN_SSCANF, "sscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VAR, ATTR_FORMAT_SCANF_NOTHROW_2_3)
DEF_C99_BUILTIN        (BUILT_IN_VFSCANF, "vfscanf", BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0)
DEF_LIB_BUILTIN        (BUILT_IN_VPRINTF, "vprintf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_1_0)
DEF_C99_BUILTIN        (BUILT_IN_VSCANF, "vscanf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_1_0)
DEF_C99_BUILTIN        (BUILT_IN_VSNPRINTF, "vsnprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_3_0)
DEF_C99_BUILTIN        (BUILT_IN_VSSCANF, "vsscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_NOTHROW_2_0)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_DCGETTEXT, "dcgettext", BT_FN_STRING_CONST_STRING_CONST_STRING_INT, ATTR_FORMAT_ARG_2)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_DGETTEXT, "dgettext", BT_FN_STRING_CONST_STRING_CONST_STRING, ATTR_FORMAT_ARG_2)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_GETTEXT, "gettext", BT_FN_STRING_CONST_STRING, ATTR_FORMAT_ARG_1)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_NOTHROW_3_4)
DEF_LIB_BUILTIN        (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_TM_PTR, ATTR_FORMAT_STRFTIME_NOTHROW_3_0)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_SNPRINTF_CHK, "__snprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_5_6)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_VSNPRINTF_CHK, "__vsnprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_5_0)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_PRINTF_CHK, "__printf_chk", BT_FN_INT_INT_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3)
DEF_EXT_LIB_BUILTIN    (BUILT_IN_VPRINTF_CHK, "__vprintf_chk", BT_FN_INT_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0)

Martin

  reply	other threads:[~2022-01-11 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 18:33 Tomas Kalibera
2022-01-11 13:37 ` Martin Liška [this message]
2022-01-12 13:34   ` Tomas Kalibera
2022-01-13  9:40     ` Martin Liška
2022-01-13 11:00       ` Tomas Kalibera
2022-05-11  8:21         ` Martin Liška
2022-05-11 16:43           ` Joseph Myers
2022-05-12 15:19             ` Martin Storsjö
2022-05-16 11:27             ` Tomas Kalibera
2022-07-04 16:40               ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=466c29c3-54b1-5627-3d9d-e385ad037a4e@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=martin@martin.st \
    --cc=redi@gcc.gnu.org \
    --cc=tomas.kalibera@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).