From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id U9KcLm3QdmG8eAAAWB0awg (envelope-from ) for ; Mon, 25 Oct 2021 11:42:37 -0400 Received: by simark.ca (Postfix, from userid 112) id AC2791F0BD; Mon, 25 Oct 2021 11:42:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E30F81EDDB for ; Mon, 25 Oct 2021 11:42:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68EC6385843E for ; Mon, 25 Oct 2021 15:42:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68EC6385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635176556; bh=lEkOy2weI+ImQHbK8ZX5Nb0O7h7H33BT9S4nj26hQsE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=gxIUpiG92uc5AP7HRsCJi4TOV/7dwrhLCTNG2Q7NwU5+bp+Ay2G5FlMpoKAwwTJbf vozH7ySPf1kSNFLZOoJlAI06s1nso+Vfo8lh5y8f1grgeTCbO1RUm6CuvN1+XrN40G EF2GnQMK8SNJoDsW/dqWFVDU3QRImG/vaYCu+Zrc= Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id E73463858C27 for ; Mon, 25 Oct 2021 15:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E73463858C27 Received: by mail-pl1-x630.google.com with SMTP id n11so8213957plf.4 for ; Mon, 25 Oct 2021 08:42:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lEkOy2weI+ImQHbK8ZX5Nb0O7h7H33BT9S4nj26hQsE=; b=IRUlph7AyDbVnQgEKdpXxobTLawEf7GOQ55Vh6OcoWhQ6a3CoR9ZLNKpPXK5og/imU W2Z0LmR+Ziigaifeqe+fgxqAlCW5h8/fIcb04HCUDu/k1ivIN6Lp5jO3I0BBmLfr+n8H pmL+QVReltM/0FxZq5ycffN7npSWz+u1ncgiWazDoe44HQ3Cz6mZJsvAUgdcJ3qaAIkG FvZbEAhjGK7RjafszBVk14orsVK+ajbADrw4dWvi7PJ5ojpGdLfWQ526E2nR0qILXOOO WP1io94ejeZ6c0dZOoYexllJboF1QpAaDo9sIkKOuZJ2+qVJkeTPizMrvhvq/keGcU6R jnNw== X-Gm-Message-State: AOAM533qipoTIZ41zeNV8j1lNrHFn+9CRNoyUrRhSAUamETrF9y9Wqfd TCHLgINh5Oui5S7nX7Y74q5Te1QuEIz0t051kYE= X-Google-Smtp-Source: ABdhPJyjdr/r3l8ovCrQWMUTMGwqjc+6IzlxEHcXsgkc3ADQDRTvcaZo+PQv/9F5XEZw2yyZRRle+w== X-Received: by 2002:a17:90a:74c2:: with SMTP id p2mr9303538pjl.205.1635176535718; Mon, 25 Oct 2021 08:42:15 -0700 (PDT) Received: from TestRunner.tealfjua5x4elltdavttcl1iug.xx.internal.cloudapp.net ([52.156.76.224]) by smtp.gmail.com with ESMTPSA id 91sm8504988pjz.9.2021.10.25.08.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 08:42:15 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH] Fix using gnu print on mingw Date: Mon, 25 Oct 2021 15:42:13 +0000 Message-Id: <20211025154213.1783071-1-orgads@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Orgad Shaneh via Gdb-patches Reply-To: Orgad Shaneh Cc: Orgad Shaneh Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" MinGW (both 32 and 64) uses (and defines) MSVCRT by default, but it has 2 working modes. If __USE_MINGW_ANSI_STDIO is defined as 1 (this is the case for C++11, or when _GNU_SOURCE is defined, or some other defines), then modifiers like %ll ARE supported. If it is 0, then they're not. --- bfd/bfd-in.h | 2 +- bfd/bfd-in2.h | 2 +- gdbsupport/format.h | 6 +++++- gnulib/import/inttypes.in.h | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 286afc607a3..642e3918845 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -131,7 +131,7 @@ typedef BFD_HOST_U_64_BIT symvalue; #if BFD_HOST_64BIT_LONG #define BFD_VMA_FMT "l" -#elif defined (__MSVCRT__) +#elif defined(__MSVCRT__) && !__USE_MINGW_ANSI_STDIO #define BFD_VMA_FMT "I64" #else #define BFD_VMA_FMT "ll" diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 669f250d0e5..8fb2fafd1d1 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -138,7 +138,7 @@ typedef BFD_HOST_U_64_BIT symvalue; #if BFD_HOST_64BIT_LONG #define BFD_VMA_FMT "l" -#elif defined (__MSVCRT__) +#elif defined (__MSVCRT__) && !__USE_MINGW_ANSI_STDIO #define BFD_VMA_FMT "I64" #else #define BFD_VMA_FMT "ll" diff --git a/gdbsupport/format.h b/gdbsupport/format.h index 921fca5e04d..b7520fb63d6 100644 --- a/gdbsupport/format.h +++ b/gdbsupport/format.h @@ -23,7 +23,11 @@ #include "gdbsupport/gdb_string_view.h" #if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG) -# define USE_PRINTF_I64 1 +# if !__USE_MINGW_ANSI_STDIO +# define USE_PRINTF_I64 1 +# else +# define USE_PRINTF_I64 0 +# endif # define PRINTF_HAS_LONG_LONG #else # define USE_PRINTF_I64 0 diff --git a/gnulib/import/inttypes.in.h b/gnulib/import/inttypes.in.h index e9ee500e3e6..5fdf4663cc3 100644 --- a/gnulib/import/inttypes.in.h +++ b/gnulib/import/inttypes.in.h @@ -171,7 +171,7 @@ #ifdef INT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) # define _PRI64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ +# elif (defined _MSC_VER || defined __MINGW32__) && !__USE_MINGW_ANSI_STDIO # define _PRI64_PREFIX "I64" # elif LONG_MAX >> 30 == 1 # define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX @@ -186,7 +186,7 @@ #ifdef UINT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) # define _PRIu64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ +# elif (defined _MSC_VER || defined __MINGW32__) && !__USE_MINGW_ANSI_STDIO # define _PRIu64_PREFIX "I64" # elif ULONG_MAX >> 31 == 1 # define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX @@ -583,7 +583,7 @@ #ifdef INT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) # define _SCN64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ +# elif (defined _MSC_VER || defined __MINGW32__) && !__USE_MINGW_ANSI_STDIO # define _SCN64_PREFIX "I64" # elif LONG_MAX >> 30 == 1 # define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX @@ -598,7 +598,7 @@ #ifdef UINT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) # define _SCNu64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ +# elif (defined _MSC_VER || defined __MINGW32__) && !__USE_MINGW_ANSI_STDIO # define _SCNu64_PREFIX "I64" # elif ULONG_MAX >> 31 == 1 # define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX -- 2.25.1