This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rely on C89 <stdlib.h>
authorAaron Crane <arc@cpan.org>
Fri, 13 Oct 2017 07:16:17 +0000 (09:16 +0200)
committerAaron Crane <arc@cpan.org>
Sat, 21 Oct 2017 15:52:39 +0000 (16:52 +0100)
The Configure changes here were generated using a version of metaconfig
that copies U/modified/i_stdlib.U from dist/U/vaproto.U, and changes it to
unconditionally define the i_stdlib Configure variable. That variable is
used by a large number of other Configure units, so it's not actually
practical to try and remove the relevant unit entirely.

17 files changed:
Configure
NetWare/config_H.wc
Porting/Glossary
Porting/config_H
cflags.SH
config_h.SH
ext/POSIX/POSIX.xs
ext/POSIX/lib/POSIX.pm
ext/SDBM_File/sdbm.h
hints/irix_6.sh
perl.h
plan9/config.plan9
plan9/config_h.sample
uconfig.h
win32/config_H.ce
win32/config_H.gc
win32/config_H.vc

index 703bfbe..c5114ff 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -5790,6 +5790,107 @@ mc_file=$1;
 shift;
 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
+: stub, used only to satisfy other units
+i_stdlib='define'
+
+: check for lengths of integral types
+echo " "
+case "$intsize" in
+'')
+       echo "Checking to see how big your integers are..." >&4
+       $cat >try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main()
+{
+       printf("intsize=%d;\n", (int)sizeof(int));
+       printf("longsize=%d;\n", (int)sizeof(long));
+       printf("shortsize=%d;\n", (int)sizeof(short));
+       exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok && $run ./try > /dev/null; then
+               eval `$run ./try`
+               echo "Your integers are $intsize bytes long."
+               echo "Your long integers are $longsize bytes long."
+               echo "Your short integers are $shortsize bytes long."
+       else
+               $cat >&4 <<EOM
+!
+Help! I can't compile and run the intsize test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
+!
+EOM
+               dflt=4
+               rp="What is the size of an integer (in bytes)?"
+               . ./myread
+               intsize="$ans"
+               dflt=$intsize
+               rp="What is the size of a long integer (in bytes)?"
+               . ./myread
+               longsize="$ans"
+               dflt=2
+               rp="What is the size of a short integer (in bytes)?"
+               . ./myread
+               shortsize="$ans"
+       fi
+       ;;
+esac
+$rm_try
+
+: check for long long
+echo " "
+echo "Checking to see if you have long long..." >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have long long."
+else
+       val="$undef"
+       echo "You do not have long long."
+fi
+$rm_try
+set d_longlong
+eval $setvar
+
+: check for length of long long
+case "${d_longlong}${longlongsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long longs are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               longlongsize=`$run ./try`
+               echo "Your long longs are $longlongsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a long long (in bytes)?"
+               . ./myread
+               longlongsize="$ans"
+       fi
+       if $test "X$longsize" = "X$longlongsize"; then
+               echo "(That isn't any different from an ordinary long.)"
+       fi
+       ;;
+esac
+$rm_try
+
 : determine filename position in cpp output
 echo " "
 echo "Computing filename position in cpp output for #include directives..." >&4
@@ -5902,108 +6003,6 @@ do set $yyy; var=$2; eval "was=\$$2";
        set $yyy; shift; shift; yyy=$@;
 done'
 
-: see if stdlib is available
-set stdlib.h i_stdlib
-eval $inhdr
-
-: check for lengths of integral types
-echo " "
-case "$intsize" in
-'')
-       echo "Checking to see how big your integers are..." >&4
-       $cat >try.c <<EOCP
-#include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-int main()
-{
-       printf("intsize=%d;\n", (int)sizeof(int));
-       printf("longsize=%d;\n", (int)sizeof(long));
-       printf("shortsize=%d;\n", (int)sizeof(short));
-       exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok && $run ./try > /dev/null; then
-               eval `$run ./try`
-               echo "Your integers are $intsize bytes long."
-               echo "Your long integers are $longsize bytes long."
-               echo "Your short integers are $shortsize bytes long."
-       else
-               $cat >&4 <<EOM
-!
-Help! I can't compile and run the intsize test program: please enlighten me!
-(This is probably a misconfiguration in your system or libraries, and
-you really ought to fix it.  Still, I'll try anyway.)
-!
-EOM
-               dflt=4
-               rp="What is the size of an integer (in bytes)?"
-               . ./myread
-               intsize="$ans"
-               dflt=$intsize
-               rp="What is the size of a long integer (in bytes)?"
-               . ./myread
-               longsize="$ans"
-               dflt=2
-               rp="What is the size of a short integer (in bytes)?"
-               . ./myread
-               shortsize="$ans"
-       fi
-       ;;
-esac
-$rm_try
-
-: check for long long
-echo " "
-echo "Checking to see if you have long long..." >&4
-echo 'int main() { long long x = 7; return 0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long long."
-else
-       val="$undef"
-       echo "You do not have long long."
-fi
-$rm_try
-set d_longlong
-eval $setvar
-
-: check for length of long long
-case "${d_longlong}${longlongsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long longs are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(long long));
-    return(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               longlongsize=`$run ./try`
-               echo "Your long longs are $longlongsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a long long (in bytes)?"
-               . ./myread
-               longlongsize="$ans"
-       fi
-       if $test "X$longsize" = "X$longlongsize"; then
-               echo "(That isn't any different from an ordinary long.)"
-       fi
-       ;;
-esac
-$rm_try
-
 : see if inttypes.h is available
 : we want a real compile instead of Inhdr because some systems
 : have an inttypes.h which includes non-existent headers
index 8598a5a..1ed624a 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index df598c0..5fcaeec 100644 (file)
@@ -3616,11 +3616,6 @@ i_stdint (i_stdint.U):
        indicates to the C program that <stdint.h> exists and should
        be included.
 
-i_stdlib (i_stdlib.U):
-       This variable conditionally defines the I_STDLIB symbol, which
-       indicates to the C program that <stdlib.h> exists and should
-       be included.
-
 i_string (i_string.U):
        This variable conditionally defines the I_STRING symbol, which
        indicates that <string.h> should be included rather than <strings.h>.
index 97622ad..000fa36 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index dc373c7..fd2a2c2 100755 (executable)
--- a/cflags.SH
+++ b/cflags.SH
@@ -73,9 +73,7 @@ cat >_cflags.c <<__EOT__
 #include <setjmp.h>
 /* Just in case the inclusion of perl.h did not
  * pull in enough system headers, let's try again. */
-#ifdef I_STDLIB
 #include <stdlib.h>
-#endif
 #ifdef I_STDDEF
 #include <stddef.h>
 #endif
index a8c9672..5e259a1 100755 (executable)
@@ -731,12 +731,6 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
  */
 #$i_stddef I_STDDEF    /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#$i_stdlib I_STDLIB            /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index 2d52326..ab50226 100644 (file)
@@ -1336,9 +1336,7 @@ static NV_PAYLOAD_TYPE S_getpayload(NV nv)
 #if defined(I_TERMIOS)
 #include <termios.h>
 #endif
-#ifdef I_STDLIB
 #include <stdlib.h>
-#endif
 #ifndef __ultrix__
 #include <string.h>
 #endif
index 2d7238a..2fd13c2 100644 (file)
@@ -4,7 +4,7 @@ use warnings;
 
 our ($AUTOLOAD, %SIGRT);
 
-our $VERSION = '1.78';
+our $VERSION = '1.79';
 
 require XSLoader;
 
index d5511da..cfb4552 100644 (file)
@@ -153,10 +153,8 @@ extern long sdbm_hash(const char *, int);
 # endif
 #endif
 
-/* Use all the "standard" definitions? */
-#if defined(STANDARD_C) && defined(I_STDLIB)
-#   include <stdlib.h>
-#endif /* STANDARD_C */
+/* Use all the "standard" definitions */
+#include <stdlib.h>
 
 #define MEM_SIZE Size_t
 
index 832fde2..f16ae46 100644 (file)
@@ -580,10 +580,7 @@ $define|true|[yY]*)
 
 #define sPRIfldbl $sPRIfldbl
 
-#define I_STDLIB $i_stdlib
-#ifdef I_STDLIB
 #include <stdlib.h>
-#endif
 
 int main()
 { 
@@ -622,10 +619,7 @@ EOP
 
 #define sPRIfldbl $sPRIfldbl
 
-#define I_STDLIB $i_stdlib
-#ifdef I_STDLIB
 #include <stdlib.h>
-#endif
 
 int main()
 { 
diff --git a/perl.h b/perl.h
index ce883d3..042c6d9 100644 (file)
--- a/perl.h
+++ b/perl.h
 #   endif
 #endif
 
-/* Use all the "standard" definitions? */
-#if defined(STANDARD_C) && defined(I_STDLIB)
-#   include <stdlib.h>
-#endif
+/* Use all the "standard" definitions */
+#include <stdlib.h>
 
 /* If this causes problems, set i_unistd=undef in the hint file.  */
 #ifdef I_UNISTD
index 0fcfa82..0daf313 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index bd88610..dcf3bdc 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index 0755da1..db249d1 100644 (file)
--- a/uconfig.h
+++ b/uconfig.h
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
 #endif
 
 /* Generated from:
- * 9ac22558a2db3bead054c2b016d0b70095e52fce40430a65015f21cd91dcc943 config_h.SH
+ * 71879525dcc4fa1f709eedff386a3384fad9b06f7f066a51ecc7f6bba9331b24 config_h.SH
  * 408e88881e8a567afeba7b56cb949d7886e8473896575932bfdef72ee9c32249 uconfig.sh
  * ex: set ro: */
index 71007f3..331bca2 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index 7451d62..3d19d61 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).
index 6af02b3..7ca7306 100644 (file)
  */
 #define I_STDDEF       /**/
 
-/* I_STDLIB:
- *     This symbol, if defined, indicates that <stdlib.h> exists and should
- *     be included.
- */
-#define I_STDLIB               /**/
-
 /* I_STRING:
  *     This symbol, if defined, indicates to the C program that it should
  *     include <string.h> (USG systems) instead of <strings.h> (BSD systems).