This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix strtoll, strotoull, and strtouq probes to compile under clang++.
authorAndy Dougherty <doughera@lafayete.edu>
Mon, 30 Dec 2019 02:43:24 +0000 (21:43 -0500)
committerAndy Dougherty <doughera@lafayete.edu>
Tue, 31 Dec 2019 02:03:22 +0000 (21:03 -0500)
The test programs were missing the stdlib.h header, and needed
tweaks to the check() prototype to compile under clang++.  These
changes should be fine for C compilers as well, but they have typically
been more forgiving, so shouldn't be affected.

U/perl/d_strtoll.U
U/perl/d_strtoull.U
U/perl/d_strtouq.U

index 5f6a189..5cca418 100644 (file)
@@ -37,9 +37,9 @@ EOM
 #define strtoll _strtoll
 #endif
 #include <stdio.h>
-extern long long int strtoll(char *s, char **, int);
+#include <stdlib.h>
 static int bad = 0;
-int check(char *s, long long ell, int een) {
+void check(const char *s, long long ell, int een) {
        long long gll;
        errno = 0;
        gll = strtoll(s, 0, 10);
index a4c4ea5..4fbaf46 100644 (file)
@@ -32,10 +32,10 @@ EOM
 #ifdef __hpux
 #define strtoull __strtoull
 #endif
+#include <stdlib.h>
 #include <stdio.h>
-extern unsigned long long int strtoull(char *s, char **, int);
 static int bad = 0;
-int check(char *s, long long eull, int een) {
+void check(const char *s, long long eull, int een) {
        long long gull;
        errno = 0;
        gull = strtoull(s, 0, 10);
index d68a050..215135f 100644 (file)
@@ -28,11 +28,11 @@ case "$d_strtouq" in
 Checking whether your strtouq() works okay...
 EOM
        $cat >try.c <<'EOCP'
+#include <stdlib.h>
 #include <errno.h>
 #include <stdio.h>
-extern unsigned long long int strtouq(char *s, char **, int);
 static int bad = 0;
-void check(char *s, unsigned long long eull, int een) {
+void check(const char *s, unsigned long long eull, int een) {
        unsigned long long gull;
        errno = 0;
        gull = strtouq(s, 0, 10);