Use POSIX format specifiers on Windows. [chromium/mini_chromium : main]

10 views
Skip to first unread message

Peter Kasting (Gerrit)

unread,
Oct 16, 2023, 3:59:15 PM10/16/23
to Mark Mentovai, crashp...@chromium.org

Attention is currently required from: Mark Mentovai.

View Change

    To view, visit change 4942896. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/mini_chromium
    Gerrit-Branch: main
    Gerrit-Change-Id: I6efb7bc922461fca9c211f32feb51fd8171c1478
    Gerrit-Change-Number: 4942896
    Gerrit-PatchSet: 1
    Gerrit-Owner: Peter Kasting <pkas...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Mon, 16 Oct 2023 19:59:10 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No

    Mark Mentovai (Gerrit)

    unread,
    Oct 16, 2023, 4:09:02 PM10/16/23
    to Peter Kasting, crashp...@chromium.org

    Attention is currently required from: Peter Kasting.

    Patch set 1:Code-Review +1

    View Change

      To view, visit change 4942896. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: comment
      Gerrit-Project: chromium/mini_chromium
      Gerrit-Branch: main
      Gerrit-Change-Id: I6efb7bc922461fca9c211f32feb51fd8171c1478
      Gerrit-Change-Number: 4942896
      Gerrit-PatchSet: 1
      Gerrit-Owner: Peter Kasting <pkas...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Peter Kasting <pkas...@chromium.org>
      Gerrit-Comment-Date: Mon, 16 Oct 2023 20:08:59 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes

      Mark Mentovai (Gerrit)

      unread,
      Oct 16, 2023, 4:09:08 PM10/16/23
      to Peter Kasting, crashp...@chromium.org

      Mark Mentovai submitted this change.

      View Change

      Approvals: Mark Mentovai: Looks good to me
      Use POSIX format specifiers on Windows.

      MSVC (and clang-cl) have supported these for ~8 years. This change
      brings this header close to the upstream one in Chromium.

      Bug: 1371963
      Change-Id: I6efb7bc922461fca9c211f32feb51fd8171c1478
      Reviewed-on: https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/4942896
      Reviewed-by: Mark Mentovai <ma...@chromium.org>
      ---
      M base/format_macros.h
      1 file changed, 3 insertions(+), 34 deletions(-)

      diff --git a/base/format_macros.h b/base/format_macros.h
      index 0cf2f00..b273a2e 100644
      --- a/base/format_macros.h
      +++ b/base/format_macros.h
      @@ -23,25 +23,18 @@

      #include "build/build_config.h"

      -#if BUILDFLAG(IS_POSIX)
      -
      -#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64)
      +#if BUILDFLAG(IS_POSIX) && \
      + (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64)
      #error "inttypes.h has already been included before this header file, but "
      #error "without __STDC_FORMAT_MACROS defined."
      #endif

      -#if !defined(__STDC_FORMAT_MACROS)
      +#if BUILDFLAG(IS_POSIX) && !defined(__STDC_FORMAT_MACROS)
      #define __STDC_FORMAT_MACROS
      #endif

      #include <inttypes.h>

      -// GCC will concatenate wide and narrow strings correctly, so nothing needs to
      -// be done here.
      -#define WidePRId64 PRId64
      -#define WidePRIu64 PRIu64
      -#define WidePRIx64 PRIx64
      -
      #if !defined(PRIuS)
      #define PRIuS "zu"
      #endif
      @@ -74,28 +67,4 @@
      #endif
      #endif // BUILDFLAG(IS_APPLE)

      -#else // BUILDFLAG(IS_WIN)
      -
      -#if !defined(PRId64)
      -#define PRId64 "I64d"
      -#endif
      -
      -#if !defined(PRIu64)
      -#define PRIu64 "I64u"
      -#endif
      -
      -#if !defined(PRIx64)
      -#define PRIx64 "I64x"
      -#endif
      -
      -#define WidePRId64 L"I64d"
      -#define WidePRIu64 L"I64u"
      -#define WidePRIx64 L"I64x"
      -
      -#if !defined(PRIuS)
      -#define PRIuS "Iu"
      -#endif
      -
      -#endif
      -
      #endif // BASE_FORMAT_MACROS_H_

      To view, visit change 4942896. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: merged
      Gerrit-Project: chromium/mini_chromium
      Gerrit-Branch: main
      Gerrit-Change-Id: I6efb7bc922461fca9c211f32feb51fd8171c1478
      Gerrit-Change-Number: 4942896
      Gerrit-PatchSet: 2
      Reply all
      Reply to author
      Forward
      0 new messages