Skip to content

Commit

Permalink
Rely on C89 <stdarg.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
arc committed Oct 21, 2017
1 parent 3d97541 commit 9d82a2b
Show file tree
Hide file tree
Showing 27 changed files with 4 additions and 300 deletions.
115 changes: 0 additions & 115 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,6 @@ i_unistd=''
i_ustat=''
i_utime=''
i_values=''
i_stdarg=''
i_varargs=''
i_varhdr=''
i_vfork=''
i_wchar=''
d_inc_version_list=''
Expand Down Expand Up @@ -23279,115 +23276,6 @@ set i_termio; eval $setvar
val=$val2; set i_sgtty; eval $setvar
val=$val3; set i_termios; eval $setvar

: see if stdarg is available
echo " "
if $test `./findhdr stdarg.h`; then
echo "<stdarg.h> found." >&4
valstd="$define"
else
echo "<stdarg.h> NOT found." >&4
valstd="$undef"
fi

: see if varargs is available
echo " "
if $test `./findhdr varargs.h`; then
echo "<varargs.h> found." >&4
else
echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
fi

: set up the varargs testing programs
$cat > varargs.c <<EOP
#ifdef I_STDARG
#include <stdarg.h>
#endif
#ifdef I_VARARGS
#include <varargs.h>
#endif

#ifdef I_STDARG
int f(char *p, ...)
#else
int f(va_alist)
va_dcl
#endif
{
va_list ap;
#ifndef I_STDARG
char *p;
#endif
#ifdef I_STDARG
va_start(ap,p);
#else
va_start(ap);
p = va_arg(ap, char *);
#endif
va_end(ap);
return 0;
}
EOP
$cat > varargs <<EOP
$startsh
if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
echo "true"
else
echo "false"
fi
$rm -f varargs$_o
EOP
chmod +x varargs

: now check which varargs header should be included
echo " "
i_varhdr=''
val=''
case "$valstd" in
"$define")
if `./varargs I_STDARG`; then
val='stdarg.h'
elif `./varargs I_VARARGS`; then
val='varargs.h'
fi
;;
*)
if `./varargs I_VARARGS`; then
val='varargs.h'
fi
;;
esac
case "$val" in
'')
echo " "
echo "*** WHOA THERE!!! ***" >&4
echo " Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
case "$knowitall" in
'')
echo " I'm giving up; maybe you can try again with a different compiler?" >&4
exit 1
;;
esac
echo "I could not find the definition for va_dcl... You have problems..." >&4
val="$undef"; set i_stdarg; eval $setvar
val="$undef"; set i_varargs; eval $setvar
;;
*)
set i_varhdr
eval $setvar
case "$i_varhdr" in
stdarg.h)
val="$define"; set i_stdarg; eval $setvar
val="$undef"; set i_varargs; eval $setvar
;;
varargs.h)
val="$undef"; set i_stdarg; eval $setvar
val="$define"; set i_varargs; eval $setvar
;;
esac
echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
esac
$rm -f varargs*

: see if stdbool is available
: we want a real compile instead of Inhdr because some Solaris systems
: have stdbool.h, but it can only be used if the compiler indicates it
Expand Down Expand Up @@ -24821,7 +24709,6 @@ i_rpcsvcdbm='$i_rpcsvcdbm'
i_sgtty='$i_sgtty'
i_shadow='$i_shadow'
i_socks='$i_socks'
i_stdarg='$i_stdarg'
i_stdbool='$i_stdbool'
i_stddef='$i_stddef'
i_stdint='$i_stdint'
Expand Down Expand Up @@ -24864,8 +24751,6 @@ i_unistd='$i_unistd'
i_ustat='$i_ustat'
i_utime='$i_utime'
i_values='$i_values'
i_varargs='$i_varargs'
i_varhdr='$i_varhdr'
i_vfork='$i_vfork'
i_wchar='$i_wchar'
i_xlocale='$i_xlocale'
Expand Down
3 changes: 0 additions & 3 deletions Cross/config.sh-arm-linux
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ i_rpcsvcdbm='undef'
i_sgtty='undef'
i_shadow='define'
i_socks='undef'
i_stdarg='define'
i_stdbool='undef'
i_stddef='define'
i_stdint='define'
Expand Down Expand Up @@ -815,8 +814,6 @@ i_unistd='define'
i_ustat='define'
i_utime='define'
i_values='define'
i_varargs='undef'
i_varhdr='stdarg.h'
i_vfork='undef'
i_wchar='undef'
i_xlocale='undef'
Expand Down
3 changes: 0 additions & 3 deletions Cross/config.sh-arm-linux-n770
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ i_rpcsvcdbm='undef'
i_sgtty='undef'
i_shadow='define'
i_socks='undef'
i_stdarg='define'
i_stddef='define'
i_stdlib='define'
i_string='define'
Expand Down Expand Up @@ -673,8 +672,6 @@ i_unistd='define'
i_ustat='define'
i_utime='define'
i_values='define'
i_varargs='undef'
i_varhdr='stdarg.h'
i_vfork='undef'
ignore_versioned_solibs='y'
inc_version_list=' '
Expand Down
21 changes: 0 additions & 21 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -1532,27 +1532,6 @@ PERL5LIB, and PERL5OPT will influence the behaviour of the test suite.
So if you are getting strange test failures, you may want to try
retesting with the various PERL variables unset.

=item varargs

If you get varargs problems with gcc, be sure that gcc is installed
correctly and that you are not passing -I/usr/include to gcc. When using
gcc, you should probably have i_stdarg='define' and i_varargs='undef'
in config.sh. The problem is usually solved by installing gcc
correctly. If you do change config.sh, don't forget to propagate
your changes (see L<"Propagating your changes to config.sh"> below).

=item util.c

If you get error messages such as the following (the exact line
numbers and function name may vary in different versions of perl):

util.c: In function 'Perl_form':
util.c:1107: number of arguments doesn't match prototype
proto.h:125: prototype declaration

it might well be a symptom of the gcc "varargs problem". See the
previous L<"varargs"> item.

=item LD_LIBRARY_PATH

If you run into dynamic loading problems, check your setting of
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -4452,7 +4452,6 @@ hints/esix4.sh Hints for named architecture
hints/fps.sh Hints for named architecture
hints/freebsd.sh Hints for named architecture
hints/freemint.sh Hints for named architecture
hints/genix.sh Hints for named architecture
hints/gnu.sh Hints for named architecture
hints/gnukfreebsd.sh Hints for named architecture
hints/gnuknetbsd.sh Hints for named architecture
Expand Down
3 changes: 0 additions & 3 deletions NetWare/config.wc
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ i_rpcsvcdbm='define'
i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
i_stdbool='define'
i_stddef='define'
i_stdint='undef'
Expand Down Expand Up @@ -797,8 +796,6 @@ i_unistd='undef'
i_ustat='undef'
i_utime='define'
i_values='undef'
i_varargs='undef'
i_varhdr='varargs.h'
i_vfork='undef'
i_wchar='undef'
i_xlocale='undef'
Expand Down
11 changes: 0 additions & 11 deletions NetWare/config_H.wc
Original file line number Diff line number Diff line change
Expand Up @@ -3233,17 +3233,6 @@
/*#define SETUID_SCRIPTS_ARE_SECURE_NOW /**/
/*#define DOSUID /**/

/* I_STDARG:
* This symbol, if defined, indicates that <stdarg.h> exists and should
* be included.
*/
/* I_VARARGS:
* This symbol, if defined, indicates to the C program that it should
* include <varargs.h>.
*/
#define I_STDARG /**/
/*#define I_VARARGS /**/

/* USE_CROSS_COMPILE:
* This symbol, if defined, indicates that Perl is being cross-compiled.
*/
Expand Down
13 changes: 0 additions & 13 deletions Porting/Glossary
Original file line number Diff line number Diff line change
Expand Up @@ -3601,11 +3601,6 @@ i_socks (i_socks.U):
This variable conditionally defines the I_SOCKS symbol, and indicates
whether a C program should include <socks.h>.

i_stdarg (i_varhdr.U):
This variable conditionally defines the I_STDARG symbol, which
indicates to the C program that <stdarg.h> exists and should
be included.

i_stdbool (i_stdbool.U):
This variable conditionally defines the I_STDBOOL symbol, which
indicates to the C program that <stdbool.h> exists and should
Expand Down Expand Up @@ -3788,14 +3783,6 @@ i_values (i_values.U):
whether a C program may include <values.h> to get symbols like MAXLONG
and friends.

i_varargs (i_varhdr.U):
This variable conditionally defines I_VARARGS, which indicates
to the C program that it should include <varargs.h>.

i_varhdr (i_varhdr.U):
Contains the name of the header to be included to get va_dcl definition.
Typically one of varargs.h or stdarg.h.

i_vfork (i_vfork.U):
This variable conditionally defines the I_VFORK symbol, and indicates
whether a C program should include vfork.h.
Expand Down
3 changes: 0 additions & 3 deletions Porting/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,6 @@ i_rpcsvcdbm='undef'
i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
i_stdbool='define'
i_stddef='define'
i_stdint='define'
Expand Down Expand Up @@ -833,8 +832,6 @@ i_unistd='define'
i_ustat='undef'
i_utime='define'
i_values='undef'
i_varargs='undef'
i_varhdr='stdarg.h'
i_vfork='undef'
i_wchar='undef'
i_xlocale='define'
Expand Down
11 changes: 0 additions & 11 deletions Porting/config_H
Original file line number Diff line number Diff line change
Expand Up @@ -2846,17 +2846,6 @@
*/
#define I_SYSUIO /**/

/* I_STDARG:
* This symbol, if defined, indicates that <stdarg.h> exists and should
* be included.
*/
/* I_VARARGS:
* This symbol, if defined, indicates to the C program that it should
* include <varargs.h>.
*/
#define I_STDARG /**/
/*#define I_VARARGS / **/

/* Free_t:
* This variable contains the return type of free(). It is usually
* void, but occasionally int.
Expand Down
2 changes: 0 additions & 2 deletions cflags.SH
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ cat >_cflags.c <<__EOT__
#ifdef I_STDDEF
#include <stddef.h>
#endif
#ifdef I_STDARG
#include <stdarg.h>
#endif
#ifdef I_LIMITS
#include <limits.h>
#endif
Expand Down
11 changes: 0 additions & 11 deletions config_h.SH
Original file line number Diff line number Diff line change
Expand Up @@ -2292,17 +2292,6 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#$i_termios I_TERMIOS /**/
#$i_sgtty I_SGTTY /**/
/* I_STDARG:
* This symbol, if defined, indicates that <stdarg.h> exists and should
* be included.
*/
/* I_VARARGS:
* This symbol, if defined, indicates to the C program that it should
* include <varargs.h>.
*/
#$i_stdarg I_STDARG /**/
#$i_varargs I_VARARGS /**/
/* Free_t:
* This variable contains the return type of free(). It is usually
* void, but occasionally int.
Expand Down
3 changes: 0 additions & 3 deletions configure.com
Original file line number Diff line number Diff line change
Expand Up @@ -6579,7 +6579,6 @@ $ WC "i_rpcsvcdbm='undef'"
$ WC "i_sgtty='undef'"
$ WC "i_shadow='" + i_shadow + "'"
$ WC "i_socks='" + i_socks + "'"
$ WC "i_stdarg='define'"
$ IF ccname .EQS. "DEC" .AND. F$INTEGER(Dec_C_Version).GE.60400000
$ THEN
$ WC "i_stdbool='define'"
Expand Down Expand Up @@ -6627,8 +6626,6 @@ $ WC "i_unistd='" + i_unistd + "'"
$ WC "i_ustat='undef'"
$ WC "i_utime='" + i_utime + "'"
$ WC "i_values='undef'"
$ WC "i_varargs='undef'"
$ WC "i_varhdr='stdarg.h'"
$ WC "i_vfork='undef'"
$ WC "i_wchar='undef'"
$ WC "i_xlocale='undef'"
Expand Down
1 change: 0 additions & 1 deletion hints/genix.sh

This file was deleted.

15 changes: 2 additions & 13 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,6 @@

#include <sys/types.h>

#ifdef __cplusplus
# ifndef I_STDARG
# define I_STDARG 1
# endif
#endif

/* EVC 4 SDK headers includes a bad definition of MB_CUR_MAX in stdlib.h
which is included from stdarg.h. Bad definition not present in SD 2008
SDK headers. wince.h is not yet included, so we cant fix this from there
Expand All @@ -708,13 +702,8 @@
#if defined(UNDER_CE) && (_MSC_VER < 1300)
# define MB_CUR_MAX 1
#endif
#ifdef I_STDARG
# include <stdarg.h>
#else
# ifdef I_VARARGS
# include <varargs.h>
# endif
#endif

# include <stdarg.h>

#ifdef I_STDINT
# include <stdint.h>
Expand Down
Loading

0 comments on commit 9d82a2b

Please sign in to comment.