public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Liu Hao <lh_mouse@126.com>
To: Jakub Jelinek <jakub@redhat.com>, JonY <10walls@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: mingw-w64 and __attribute__((format(printf))) issue
Date: Tue, 12 May 2020 21:15:17 +0800	[thread overview]
Message-ID: <cbad69ce-0be0-bcde-c010-3460be69fc94@126.com> (raw)
In-Reply-To: <20200512120255.GJ8462@tucnak>


[-- Attachment #1.1: Type: text/plain, Size: 1140 bytes --]

在 2020/5/12 20:02, Jakub Jelinek 写道:
> 
> gomp_fatal etc. call vfprintf under the hood though, does that one handle
> %llu on mingw?  If not, using %llu for the PRI* macros looks wrong to me.
> 

As long as libgomp doesn't enable `__USE_MINGW_ANSI_STDIO`, the answer
is a bit complex:

0) With all versions of mingw-w64 (probably MinGW.org too) that have
   been released, the MS `vfprintf()` is called; see below.

1) With current master of mingw-w64, and:

   a) -std={gnu,c}89, or
      -std={gnu,c}++03: Ditto; see below.

   b) -std={gnu,c}99, or
      -std={gnu,c}++11: The mingw-w64 one is called,
                        so it is always supported.

2) If stdio.h is not included (the user declares this function
   themselves, e.g. during configure checks), then the MS one is called;
   see below.


About the behavior of MS `vfprintf()`:

0) On Windows 7 (probably Vista and 2008, untested), *printf functions
   from MSVCRT do accept `%llu`, so it's valid despite the warning.

1) On Windows XP (probably also 2003, untested), `%lld` is not
   recognized.

-- 
Best regards,
LH_Mouse


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-05-12 13:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  5:36 Liu Hao
2020-05-06 10:48 ` [Mingw-w64-public] " Martin Storsjö
2020-05-06 12:45   ` Liu Hao
2020-05-07  4:09   ` Liu Hao
2020-05-10  4:27 ` JonY
2020-05-10  9:03   ` Liu Hao
2020-05-12 11:14     ` JonY
2020-05-12 12:02       ` Jakub Jelinek
2020-05-12 13:15         ` Liu Hao [this message]

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=cbad69ce-0be0-bcde-c010-3460be69fc94@126.com \
    --to=lh_mouse@126.com \
    --cc=10walls@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jakub@redhat.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).