From: Sami Kerola Date: Thu, 1 Dec 2011 22:10:21 +0000 (+0100) Subject: build-sys: check HAVE_ definitions with #ifdef [smatch scan] X-Git-Tag: v2.21-rc1~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbc333fec09394bf4e47707de08a65e8c0e9c288;p=thirdparty%2Futil-linux.git build-sys: check HAVE_ definitions with #ifdef [smatch scan] Fix to `warning: undefined preprocessor identifier' messages. Signed-off-by: Sami Kerola --- diff --git a/include/blkdev.h b/include/blkdev.h index 3ce8111f67..1e7409dfd2 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -9,7 +9,7 @@ #include #include -#if HAVE_SYS_MKDEV_H +#ifdef HAVE_SYS_MKDEV_H # include /* major and minor on Solaris */ #endif diff --git a/include/md5.h b/include/md5.h index 1222cf0301..d997e379d7 100644 --- a/include/md5.h +++ b/include/md5.h @@ -1,7 +1,7 @@ #ifndef MD5_H #define MD5_H -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H #include #else typedef unsigned int uint32_t; diff --git a/lib/env.c b/lib/env.c index 770cadff92..e6d119f6fd 100644 --- a/lib/env.c +++ b/lib/env.c @@ -89,7 +89,7 @@ char *safe_getenv(const char *arg) if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid())) return NULL; -#if HAVE_PRCTL +#ifdef HAVE_PRCTL if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) return NULL; #else diff --git a/lib/ismounted.c b/lib/ismounted.c index f19d67b1e6..273a7d9518 100644 --- a/lib/ismounted.c +++ b/lib/ismounted.c @@ -11,7 +11,7 @@ #include #include #include -#if HAVE_MNTENT_H +#ifdef HAVE_MNTENT_H #include #endif #include diff --git a/libblkid/src/cache.c b/libblkid/src/cache.c index 6ef22a103e..c100cfa203 100644 --- a/libblkid/src/cache.c +++ b/libblkid/src/cache.c @@ -10,7 +10,7 @@ * %End-Header% */ -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ERRNO_H diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c index 42a8c19a9d..12cd93ad33 100644 --- a/libblkid/src/devname.c +++ b/libblkid/src/devname.c @@ -16,20 +16,20 @@ #include #include #include -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #include #include #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H #include #endif #include -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H #include #endif -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif #include diff --git a/libblkid/src/devno.c b/libblkid/src/devno.c index 92ed7c0259..b2a8be537c 100644 --- a/libblkid/src/devno.c +++ b/libblkid/src/devno.c @@ -12,21 +12,21 @@ #include #include -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H #include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H #include #endif #include -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif -#if HAVE_SYS_MKDEV_H +#ifdef HAVE_SYS_MKDEV_H #include #endif #include diff --git a/libblkid/src/llseek.c b/libblkid/src/llseek.c index 5bd0e51678..7fb44c44d0 100644 --- a/libblkid/src/llseek.c +++ b/libblkid/src/llseek.c @@ -12,14 +12,14 @@ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H #include #endif -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #ifdef __MSDOS__ diff --git a/libblkid/src/read.c b/libblkid/src/read.c index c404bb0108..b9fda3aaee 100644 --- a/libblkid/src/read.c +++ b/libblkid/src/read.c @@ -19,13 +19,13 @@ #include #include #include -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif #include "blkidP.h" -#if HAVE_STDLIB_H +#ifdef HAVE_STDLIB_H # ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 600 /* for inclusion of strtoull */ # endif diff --git a/libblkid/src/resolve.c b/libblkid/src/resolve.c index bf13b86488..bf5041df52 100644 --- a/libblkid/src/resolve.c +++ b/libblkid/src/resolve.c @@ -11,7 +11,7 @@ */ #include -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #include diff --git a/libblkid/src/version.c b/libblkid/src/version.c index 4c7fa06ca6..63f02f6a9d 100644 --- a/libblkid/src/version.c +++ b/libblkid/src/version.c @@ -9,7 +9,7 @@ * %End-Header% */ -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif #include diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 1c810ca85d..c9efdf074e 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -297,7 +297,7 @@ main(int argc, char **argv) { * the locale database, which can be overridden with the * -s (Sunday) or -m (Monday) options. */ -#if HAVE_DECL__NL_TIME_WEEK_1STDAY +#ifdef HAVE_DECL__NL_TIME_WEEK_1STDAY /* * You need to use 2 locale variables to get the first day of the week. * This is needed to support first_weekday=2 and first_workday=1 for diff --git a/term-utils/script.c b/term-utils/script.c index 3891bf9526..9e08ff62a6 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -62,8 +62,10 @@ #include "nls.h" #include "c.h" -#if HAVE_LIBUTIL && HAVE_PTY_H -#include +#ifdef HAVE_LIBUTIL +# ifdef HAVE_PTY_H +# include +# endif #endif #ifdef HAVE_LIBUTEMPTER @@ -499,13 +501,15 @@ done(void) { void getmaster(void) { -#if HAVE_LIBUTIL && HAVE_PTY_H +#ifdef HAVE_LIBUTIL +# ifdef HAVE_PTY_H tcgetattr(STDIN_FILENO, &tt); ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&win); if (openpty(&master, &slave, NULL, &tt, &win) < 0) { warn(_("openpty failed")); fail(); } +# endif #else char *pty, *bank, *cp; struct stat stb;