From e0f4297ddf3f70ab49318dee70dca6d61df17b2f Mon Sep 17 00:00:00 2001 From: TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> Date: Tue, 9 Aug 2022 23:50:30 +0900 Subject: [PATCH] Configure: prefer %ll over %L for formatting long long ints Configure used to try %L, %q, and then %ll in this order to find the modifier for formatting 64-bit integers on 32-bit machines, but %L for integer conversions seems to be a non-standard GNU extension. Now it will try %ll before %q, %L to prioritize %ll which is standardized by C99. --- Configure | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Configure b/Configure index 9d3b5f73b1be..bfde4631e85b 100755 --- a/Configure +++ b/Configure @@ -21657,13 +21657,13 @@ EOCP fi fi -if $test X"$sPRId64" = X -a X"$quadtype" != X; then - $cat >try.c <try.c <<'EOCP' #include #include int main() { - $quadtype q = 12345678901; - printf("%Ld\n", q); + long long q = 12345678901LL; /* AIX cc requires the LL suffix. */ + printf("%lld\n", q); } EOCP set try @@ -21671,21 +21671,21 @@ EOCP yyy=`$run ./try` case "$yyy" in 12345678901) - sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"'; - sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"'; - echo "We will use %Ld." + sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"'; + sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"'; + echo "We will use the %lld style." ;; esac fi fi -if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then - $cat >try.c <<'EOCP' +if $test X"$sPRId64" = X -a X"$quadtype" != X; then + $cat >try.c < #include int main() { - long long q = 12345678901LL; /* AIX cc requires the LL suffix. */ - printf("%lld\n", q); + $quadtype q = 12345678901; + printf("%qd\n", q); } EOCP set try @@ -21693,9 +21693,9 @@ EOCP yyy=`$run ./try` case "$yyy" in 12345678901) - sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"'; - sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"'; - echo "We will use the %lld style." + sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"'; + sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"'; + echo "We will use %qd." ;; esac fi @@ -21707,7 +21707,7 @@ if $test X"$sPRId64" = X -a X"$quadtype" != X; then #include int main() { $quadtype q = 12345678901; - printf("%qd\n", q); + printf("%Ld\n", q); } EOCP set try @@ -21715,9 +21715,9 @@ EOCP yyy=`$run ./try` case "$yyy" in 12345678901) - sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"'; - sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"'; - echo "We will use %qd." + sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"'; + sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"'; + echo "We will use %Ld." ;; esac fi