These changes avoid a few additional cases of implicit function
declarations and implicit ints.
---
aclocal.m4| 82 ++-
configure | 73 -
m4/intdiv0.m4 | 3 ++
3 files changed, 98 insertions(+), 60 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index c42dbf3b..a384739d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -139,7 +139,7 @@ typedef int (*_bashfunc)(const char *, ...);
typedef int (*_bashfunc)();
#endif
#include
-main()
+int main()
{
_bashfunc pf;
pf = (_bashfunc) printf;
@@ -200,7 +200,7 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
-main()
+int main()
{
char *msg = (char *)_sys_siglist[2];
exit(msg == 0);
@@ -228,7 +228,7 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
#if !HAVE_DECL_SYS_SIGLIST
extern char *sys_siglist[];
#endif
-main()
+int main()
{
char *msg = sys_siglist[2];
exit(msg == 0);
@@ -281,7 +281,10 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
#include
#include
#include
-main()
+#ifdef HAVE_UNISTD_H
+#include
+#endif
+int main()
{
int fd1, fd2, fl;
fd1 = open("/dev/null", 2);
@@ -308,7 +311,8 @@ AC_DEFUN(BASH_FUNC_STRSIGNAL,
[AC_MSG_CHECKING([for the existence of strsignal])
AC_CACHE_VAL(bash_cv_have_strsignal,
[AC_TRY_LINK([#include
-#include ],
+#include
+#include ],
[char *s = (char *)strsignal(2);],
bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
AC_MSG_RESULT($bash_cv_have_strsignal)
@@ -329,6 +333,9 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
#ifdef HAVE_UNISTD_H
# include
#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_SYS_STAT_H
+# include
+#endif /* HAVE_SYS_STAT_H */
#if defined(HAVE_DIRENT_H)
# include
#else
@@ -344,7 +351,7 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
# endif
#endif /* HAVE_DIRENT_H */
#include
-main()
+int main()
{
DIR *dir;
int fd, err;
@@ -524,7 +531,7 @@ AC_TRY_RUN([
#include
#include
#include
-main()
+int main()
{
#ifdef HAVE_QUAD_T
struct rlimit rl;
@@ -609,7 +616,7 @@ getenv (name)
{
return "42";
}
-main()
+int main()
{
char *s;
/* The next allows this program to run, but does not allow bash to link
@@ -695,10 +702,13 @@ AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
AC_CACHE_VAL(bash_cv_ulimit_maxfds,
[AC_TRY_RUN([
-main()
+#ifdef HAVE_ULIMIT_H
+#include
+#endif
+int main()
{
long maxfds = ulimit(4, 0L);
-exit (maxfds == -1L);
+return maxfds == -1L;
}
], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
[AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
@@ -719,11 +729,11 @@ AC_CACHE_VAL(bash_cv_getcwd_malloc,
#include
#endif
-main()
+int main()
{
char*xpwd;
xpwd = getcwd(0, 0);
- exit (xpwd == 0);
+ return xpwd == 0;
}
], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
[AC_MSG_WARN(cannot check whether getcwd allocates memory when
cross-compiling -- defaulting to no)
@@ -768,12 +778,12 @@ AC_CACHE_VAL(bash_cv_fnm_extmatch,
[AC_TRY_RUN([
#include
-main()
+int main()
{
#ifdef FNM_EXTMATCH
- exit (0);
+ return 0;
#else
- exit (1);
+ return 1;
#endif
}
], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
@@ -799,7 +809,7 @@ AC_CACHE_VAL(bash_cv_func_sigsetjmp,
#include
#include
-main()
+int main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
exit (1);
@@ -844,11 +854,13 @@ AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
AC_CACHE_VAL(bash_cv_func_strcoll_broken,
[AC_TRY_RUN([
#include
+#include
+#include
#if defined (HAVE_LOCALE_H)
#include
#endif
-main(c, v)
+int main(c, v)
int c;
char*v[];
{
@@ -947,7 +959,7 @@ AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
#include
],
[
-main()
+int main()
{
static struct stat a;
if (a.st_blocks) return 0;
@@ -1254,8 +1266,11 @@ AC_CACHE_VAL(bash_cv_pgrp_pipe,
#ifdef HAVE_UNISTD_H
# include
#endif
+#ifdef HAVE_SYS_WAIT_H
+# include
+#endif
#include
-main()
+int main()
{
# ifdef GETPGRP_VOID
# define getpgID()getpgrp()
@@ -1350,13 +1365,13 @@ int s;
nsigint++;
}
-main()
+int main()
{
nsigint = 0;
set_signal_handler(SIGINT, sigint);
kill((int)getpid(), SIGINT);
kill((int)getpid(), SIGINT);
- exit(nsigint != 2);
+ return nsigint != 2;
}
], bash_cv_must_reinstall_sighandlers=no,
bash_cv_must_reinstall_sighandlers=yes,
[AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting
to no)
@@ -1433,10 +1448,11 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
#ifdef HAVE_UNISTD_H
#include
#endif
+#include
#include
/* Add more tests in here as appropriate. */
-main()
+int main()
{
int fd, err;
@@ -1673,7 +1689,7 @@ AC_CACHE_VAL(bash_cv_unusable_rtsigs,
# define NSIG 64
#endif
-main ()
+int main ()
{
int n_sigs = 2 * NSIG;
#ifdef SIGRTMIN
@@ -1787,7 +1803,7 @@ bash_cv_wcwidth_broken,