This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reset xxx_convert to empty string if none of 3 utilities is found
authorH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Mon, 26 Aug 2019 09:51:03 +0000 (11:51 +0200)
committerH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Mon, 26 Aug 2019 09:51:31 +0000 (11:51 +0200)
Backport 6e404ab585deadc1c32d50513f13b50ae395c00d

This will cause Configure to enter the WHOA block and default to using
sprintf.

Change Gconvert checkit() prototype for [perl #134371].

In the checkit() routine inside Configure, clang++ was taking the
if (strcmp(expect, got)) branch even though the 'expect' and 'got' strings
were identical.  A first step in debugging this was to realize that
the checkit() function never returned a value, so relabel it as void.
With clang version 7.0.1-8 (tags/RELEASE_701/final) (Debian),
this change seems to work around the strcmp issue.

Further Configure gconvert probe cleanups for C++.  As part of debugging
[perl #134375] and [perl #134371], try to eliminate warnings thrown by
clang++.

U/compline/d_gconvert.U

index 2c42dc7..d72a5cf 100644 (file)
@@ -86,15 +86,15 @@ esac
 $cat >>try.c <<EOP
 #ifdef TRY_gconvert
 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
-char *myname = "gconvert";
+const char *myname = "gconvert";
 #endif
 #ifdef TRY_gcvt
 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
-char *myname = "gcvt";
+const char *myname = "gcvt";
 #endif
 #ifdef TRY_qgcvt
 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
-char *myname = "qgcvt";
+const char *myname = "qgcvt";
 #define DOUBLETYPE long double
 #endif
 #ifdef TRY_sprintf
@@ -107,7 +107,7 @@ char *myname = "qgcvt";
 #else
 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
 #endif
-char *myname = "sprintf";
+const char *myname = "sprintf";
 #endif
 
 #ifndef DOUBLETYPE
@@ -126,7 +126,7 @@ char *myname = "sprintf";
 #endif
 #include <string.h>
 
-int checkit(char *expect, char *got)
+void checkit(const char *expect, char *got)
 {
     if (strcmp(expect, got)) {
                printf("%s oddity:  Expected %s, got %s\n",
@@ -283,6 +283,7 @@ for xxx_convert in $xxx_list; do
                fi
        else
                echo "$xxx_convert NOT found." >&4
+               xxx_convert=''
        fi
 done