]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build: fix redundant redeclaration warnings
authorSami Kerola <kerolasa@iki.fi>
Sun, 10 Jun 2012 14:37:11 +0000 (16:37 +0200)
committerSami Kerola <kerolasa@iki.fi>
Mon, 11 Jun 2012 17:51:35 +0000 (19:51 +0200)
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure.ac
getopt/getopt.c
lib/env.c
libmount/src/mountP.h
login-utils/su.c
misc-utils/kill.c
mount/fstab.c
term-utils/agetty.c
term-utils/script.c
term-utils/wall.c

index 2280e7e51f67d2d6d6441d920d1dca963f37c44a..0669f0ab5eb1a4a086a01b3d77ca3c12a132a2cb 100644 (file)
@@ -262,6 +262,16 @@ AC_CHECK_DECL([lseek64],
         #define _LARGEFILE64_SOURCE
         #include <unistd.h>])
 
+AC_CHECK_DECL([environ],
+       [AC_DEFINE(HAVE_ENVIRON_DECL, 1,
+               [Define to 1 if have **environ prototype])],
+)
+
+AC_CHECK_DECL([strsignal],
+       [AC_DEFINE(HAVE_STRSIGNAL_DECL, 1,
+               [Define to 1 if have strsignal function prototype])],
+)
+
 AC_CHECK_FUNCS([ \
        __fpending \
        __secure_getenv \
index dcc55b6b19f1eb1dcd5b6f4563e02e1f713abe8b..4ba3401934b8a4221d8aad8408187561fd96cc64 100644 (file)
@@ -86,7 +86,6 @@ int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr,
 static const char *normalize(const char *arg);
 static int generate_output(char *argv[], int argc, const char *optstr,
                           const struct option *longopts);
-int main(int argc, char *argv[]);
 static void parse_error(const char *message);
 static void add_long_options(char *options);
 static void add_longopt(const char *name, int has_arg);
index e6d119f6fd62acca096a41eb92fd32e47cd7fc79..04e0f0bc8c05ab20d72b7caf1a9e4b635c08bc6e 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -21,7 +21,9 @@
 
 #include "env.h"
 
+#ifndef HAVE_ENVIRON_DECL
 extern char **environ;
+#endif
 
 static char * const forbid[] = {
         "_RLD_=",
index c7d378eeb4ec863dda469888f0c11f65a841934e..f7cd7d53ddd085ab6873fd1143cfe0cb76b39b36 100644 (file)
@@ -380,7 +380,6 @@ extern int mnt_context_guess_fstype(struct libmnt_context *cxt);
 extern int mnt_context_prepare_helper(struct libmnt_context *cxt,
                                      const char *name, const char *type);
 extern int mnt_context_prepare_update(struct libmnt_context *cxt);
-extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt);
 extern int mnt_context_merge_mflags(struct libmnt_context *cxt);
 extern int mnt_context_update_tabs(struct libmnt_context *cxt);
 
@@ -395,7 +394,6 @@ extern int mnt_context_clear_loopdev(struct libmnt_context *cxt);
 extern int mnt_fork_context(struct libmnt_context *cxt);
 
 /* tab_update.c */
-extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd);
 extern int mnt_update_set_filename(struct libmnt_update *upd,
                                   const char *filename, int userspace_only);
 
index 0f535b9b728cfb3d3327f89756842b6b654f24ed..26222099b7dc482c772df7d0fc40884cc80d8551 100644 (file)
@@ -78,7 +78,9 @@ enum
 /* The user to become if none is specified.  */
 #define DEFAULT_USER "root"
 
+#ifndef HAVE_ENVIRON_DECL
 extern char **environ;
+#endif
 
 static void run_shell (char const *, char const *, char **, size_t)
      __attribute__ ((__noreturn__));
index c592f5203446a755400487f4dd9ddcf295e6fb61..8e2a1d87ee5fd51a785d2511b90e1d04eee52322 100644 (file)
@@ -139,7 +139,6 @@ struct signv {
 #endif
 };
 
-int main (int argc, char *argv[]);
 extern char *mybasename(char *);
 int signame_to_signum (char *sig);
 int arg_to_signum (char *arg, int mask);
@@ -149,8 +148,6 @@ void printsignals (FILE *fp);
 int usage (int status);
 int kill_verbose (char *procname, int pid, int sig);
 
-extern int *get_pids (char *, int);
-
 static char *progname;
 
 #ifdef HAVE_SIGQUEUE
index 043cc43e2aa4ef5cdc9fa6d2d07a56d4148184a3..a39459138f0765c0c424071d0d5912f7524414aa 100644 (file)
@@ -578,7 +578,9 @@ static int lockfile_fd = -1;
 static int signals_have_been_setup = 0;
 
 /* Ensure that the lock is released if we are interrupted.  */
+#ifndef HAVE_STRSIGNAL_DECL
 extern char *strsignal(int sig);       /* not always in <string.h> */
+#endif
 
 static void
 handler (int sig) {
index 9101e7fd3846054fed1cb4aef39bb030244cdd4f..862b8c49dd090e210e3644c86dbc08afba6d9900 100644 (file)
@@ -533,8 +533,6 @@ static void login_options_to_argv(char *argv[], int *argc,
 /* Parse command-line arguments. */
 static void parse_args(int argc, char **argv, struct options *op)
 {
-       extern char *optarg;
-       extern int optind;
        int c;
 
        enum {
index 07be7e98709207fdff429717744da832ceb528d1..05d9f8541f4ec991cc9bb3499fe91f8b88a0ad09 100644 (file)
@@ -158,7 +158,6 @@ int
 main(int argc, char **argv) {
        sigset_t block_mask, unblock_mask;
        struct sigaction sa;
-       extern int optind;
        int ch;
        FILE *timingfd = stderr;
 
index 3255a516682e0d36fca157e7d6977cbf3e4cb3d2..996650638fbf5f6b1c9fbe9a6796f81f547b81d9 100644 (file)
@@ -93,7 +93,6 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 
 int
 main(int argc, char **argv) {
-       extern int optind;
        int ch;
        struct iovec iov;
        struct utmp *utmpptr;