summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootstrap.conf1
-rw-r--r--configure.ac33
-rw-r--r--lib/Makefile.am2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/base64.c2
-rw-r--r--src/getlimits.c2
-rw-r--r--src/pinky.c2
-rw-r--r--src/su.c8
-rw-r--r--src/system.h2
-rw-r--r--src/timeout.c2
-rw-r--r--src/truncate.c2
-rw-r--r--src/who.c2
12 files changed, 49 insertions, 11 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index a3687d00f..2fa7f0d30 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -100,6 +100,7 @@ gnulib_modules="
vasprintf-posix
vc-list-files
verify version-etc-fsf
+ warnings
wcwidth winsz-ioctl winsz-termios write-any-file
xalloc
xfreopen
diff --git a/configure.ac b/configure.ac
index 549c7ee2c..f165893a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,39 @@ gl_EARLY
gl_INIT
coreutils_MACROS
+AC_ARG_ENABLE([gcc-warnings],
+ [AS_HELP_STRING([--enable-gcc-warnings],
+ [turn on lots of GCC warnings (not recommended)])],
+ [case $enableval in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
+ esac
+ gl_gcc_warnings=$enableval],
+ [gl_gcc_warnings=no]
+)
+
+if test "$gl_gcc_warnings" = yes; then
+ gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
+ AC_SUBST([WERROR_CFLAGS])
+ gl_WARN_ADD([-Wall])
+ gl_WARN_ADD([-Wextra])
+ gl_WARN_ADD([-Wshadow])
+ gl_WARN_ADD([-Wno-sign-compare])
+ gl_WARN_ADD([-Wformat])
+ gl_WARN_ADD([-Wformat-security])
+ gl_WARN_ADD([-Wcast-align])
+ gl_WARN_ADD([-Wpointer-arith])
+ gl_WARN_ADD([-Wwrite-strings])
+ gl_WARN_ADD([-Wbad-function-cast])
+ gl_WARN_ADD([-Wmissing-declarations])
+ gl_WARN_ADD([-Wmissing-prototypes])
+ gl_WARN_ADD([-Wstrict-prototypes])
+ AC_SUBST([WARN_CFLAGS])
+ AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
+ AC_DEFINE([_FORTIFY_SOURCE], 2,
+ [enable compile-time and run-time bounds-checking, and some warnings])
+fi
+
AC_FUNC_FORK
optional_bin_progs=
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 6b9a6b097..15ec0ea33 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -17,7 +17,7 @@
include gnulib.mk
-AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) # $(WERROR_CFLAGS)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \
diff --git a/src/Makefile.am b/src/Makefile.am
index a6bc22925..68c5f75f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,8 @@ no_install__progs = \
build_if_possible__progs = \
chroot df hostid nice pinky stty su uname uptime users who
+AM_CFLAGS = $(WARN_CFLAGS) # $(WERROR_CFLAGS)
+
EXTRA_PROGRAMS = \
$(no_install__progs) \
$(build_if_possible__progs) \
diff --git a/src/base64.c b/src/base64.c
index bfbd9e051..b5c0f71d2 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -48,7 +48,7 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
-static void
+void
usage (int status)
{
if (status != EXIT_SUCCESS)
diff --git a/src/getlimits.c b/src/getlimits.c
index 2b2bbfeea..2fd6e39a8 100644
--- a/src/getlimits.c
+++ b/src/getlimits.c
@@ -55,7 +55,7 @@
#define UID_T_MIN 0
#define GID_T_MIN 0
-static void
+void
usage (int status)
{
if (status != EXIT_SUCCESS)
diff --git a/src/pinky.c b/src/pinky.c
index 136abc5c2..957592302 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -40,7 +40,7 @@
# define MAXHOSTNAMELEN 64
#endif
-char *ttyname ();
+char *ttyname (int);
/* If true, display the hours:minutes since each user has touched
the keyboard, or blank if within the last minute, or days followed
diff --git a/src/su.c b/src/su.c
index f6b61f773..9f99b7871 100644
--- a/src/su.c
+++ b/src/su.c
@@ -118,10 +118,10 @@
/* The user to become if none is specified. */
#define DEFAULT_USER "root"
-char *crypt ();
-char *getusershell ();
-void endusershell ();
-void setusershell ();
+char *crypt (char const *key, char const *salt);
+char *getusershell (void);
+void endusershell (void);
+void setusershell (void);
extern char **environ;
diff --git a/src/system.h b/src/system.h
index 21182a47f..020f83b48 100644
--- a/src/system.h
+++ b/src/system.h
@@ -655,3 +655,5 @@ bad_cast (char const *s)
{
return (char *) s;
}
+
+void usage (int status);
diff --git a/src/timeout.c b/src/timeout.c
index 8b506f0c9..e8ecf627f 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -122,7 +122,7 @@ cleanup (int sig)
_exit (128 + sig);
}
-static void
+void
usage (int status)
{
if (status != EXIT_SUCCESS)
diff --git a/src/truncate.c b/src/truncate.c
index 3bc52ca14..c6f12b7a9 100644
--- a/src/truncate.c
+++ b/src/truncate.c
@@ -91,7 +91,7 @@ parse_len (char const *str, off_t *size)
return -1;
}
-static void
+void
usage (int status)
{
if (status != EXIT_SUCCESS)
diff --git a/src/who.c b/src/who.c
index 3bc680bc0..692b661b3 100644
--- a/src/who.c
+++ b/src/who.c
@@ -95,7 +95,7 @@
# define UT_ID(U) "??"
#endif
-char *ttyname ();
+char *ttyname (int);
/* If true, attempt to canonicalize hostnames via a DNS lookup. */
static bool do_lookup;