From bbc719ca56753b448727340d732b8183162dfdfb Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Wed, 9 May 2007 18:17:10 +0000 Subject: [PATCH] ITS#4948: '#if ' -> '#ifdef' warning cleanup --- configure.in | 2 +- contrib/ldapc++/src/ac/time.h | 4 ++-- contrib/ldaptcl/neoXldap.c | 4 ++-- include/ac/alloca.h | 2 +- include/ac/crypt.h | 2 +- include/ac/dirent.h | 8 ++++---- include/ac/errno.h | 2 +- include/ac/socket.h | 2 +- include/ac/time.h | 4 ++-- include/ac/unistd.h | 8 ++++---- include/ac/wait.h | 2 +- include/ldap_pvt.h | 10 +++++----- libraries/liblber/sockbuf.c | 2 +- libraries/libldap_r/thr_posix.c | 10 +++++----- libraries/liblutil/detach.c | 4 ++-- libraries/liblutil/lockf.c | 8 ++++---- servers/slapd/alock.c | 2 +- servers/slapd/config.c | 2 +- servers/slapd/connection.c | 2 +- servers/slapd/daemon.c | 4 ++-- servers/slapd/main.c | 4 ++-- servers/slapd/overlays/ppolicy.c | 4 ++-- servers/slapd/proto-slap.h | 6 +++--- servers/slapd/slapcommon.c | 2 +- 24 files changed, 50 insertions(+), 50 deletions(-) diff --git a/configure.in b/configure.in index 04cb8886a6..0ae3898949 100644 --- a/configure.in +++ b/configure.in @@ -1472,7 +1472,7 @@ int main(argc, argv) #endif /* make sure task runs first */ -#if HAVE_THR_YIELD +#ifdef HAVE_THR_YIELD thr_yield(); #elif defined( HAVE_SCHED_YIELD ) sched_yield(); diff --git a/contrib/ldapc++/src/ac/time.h b/contrib/ldapc++/src/ac/time.h index 332d96d053..94db3bb1b2 100644 --- a/contrib/ldapc++/src/ac/time.h +++ b/contrib/ldapc++/src/ac/time.h @@ -13,10 +13,10 @@ #ifndef _AC_TIME_H #define _AC_TIME_H -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include # include -#elif HAVE_SYS_TIME_H +#elif defined HAVE_SYS_TIME_H # include # ifdef HAVE_SYS_TIMEB_H # include diff --git a/contrib/ldaptcl/neoXldap.c b/contrib/ldaptcl/neoXldap.c index a9f1a8f2b9..b1ce03e705 100644 --- a/contrib/ldaptcl/neoXldap.c +++ b/contrib/ldaptcl/neoXldap.c @@ -1408,7 +1408,7 @@ NeoX_LdapObjCmd (clientData, interp, objc, objv) } ldap = ldap_init (ldapHost, ldapPort); -#if LDAP_OPT_PROTOCOL_VERSION +#ifdef LDAP_OPT_PROTOCOL_VERSION if (version != -1) ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION, &version); #endif @@ -1426,7 +1426,7 @@ NeoX_LdapObjCmd (clientData, interp, objc, objv) return TCL_ERROR; } -#if UMICH_LDAP +#ifdef UMICH_LDAP ldap->ld_deref = LDAP_DEREF_NEVER; /* Turn off alias dereferencing */ #endif diff --git a/include/ac/alloca.h b/include/ac/alloca.h index 20884dd9bc..be352ccdd6 100644 --- a/include/ac/alloca.h +++ b/include/ac/alloca.h @@ -26,7 +26,7 @@ #ifdef __GNUC__ # define alloca __builtin_alloca #else -# if HAVE_ALLOCA_H +# ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX diff --git a/include/ac/crypt.h b/include/ac/crypt.h index 4596a06cbe..c5a16bd1fb 100644 --- a/include/ac/crypt.h +++ b/include/ac/crypt.h @@ -20,7 +20,7 @@ #include /* crypt() may be defined in a separate include file */ -#if HAVE_CRYPT_H +#ifdef HAVE_CRYPT_H # include #else extern char *(crypt)(); diff --git a/include/ac/dirent.h b/include/ac/dirent.h index 169d29d502..6b4de339b5 100644 --- a/include/ac/dirent.h +++ b/include/ac/dirent.h @@ -17,7 +17,7 @@ #ifndef _AC_DIRENT_H #define _AC_DIRENT_H -#if HAVE_DIRENT_H +#ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #elif defined(_MSC_VER) @@ -37,13 +37,13 @@ typedef struct DIR { #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H +# ifdef HAVE_SYS_NDIR_H # include # endif -# if HAVE_SYS_DIR_H +# ifdef HAVE_SYS_DIR_H # include # endif -# if HAVE_NDIR_H +# ifdef HAVE_NDIR_H # include # endif #endif diff --git a/include/ac/errno.h b/include/ac/errno.h index 89ef242ef7..601f2456ba 100644 --- a/include/ac/errno.h +++ b/include/ac/errno.h @@ -27,7 +27,7 @@ /* no sys_errlist */ # define sys_nerr 0 # define sys_errlist ((char **)0) -#elif DECL_SYS_ERRLIST +#elif defined( DECL_SYS_ERRLIST ) /* have sys_errlist but need declaration */ LDAP_LIBC_V(int) sys_nerr; LDAP_LIBC_V(char) *sys_errlist[]; diff --git a/include/ac/socket.h b/include/ac/socket.h index 3ee751e3a6..d5644b3dfa 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -127,7 +127,7 @@ LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int)); # define tcp_write( s, buf, len ) netwrite( s, buf, len ) # endif /* NCSA */ -#elif HAVE_CLOSESOCKET +#elif defined(HAVE_CLOSESOCKET) # define tcp_close( s ) closesocket( s ) # ifdef __BEOS__ diff --git a/include/ac/time.h b/include/ac/time.h index 6dd5b541dc..cdf8cebb5a 100644 --- a/include/ac/time.h +++ b/include/ac/time.h @@ -17,10 +17,10 @@ #ifndef _AC_TIME_H #define _AC_TIME_H -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include # include -#elif HAVE_SYS_TIME_H +#elif defined(HAVE_SYS_TIME_H) # include # ifdef HAVE_SYS_TIMEB_H # include diff --git a/include/ac/unistd.h b/include/ac/unistd.h index dd3c2788ae..c3accf6253 100644 --- a/include/ac/unistd.h +++ b/include/ac/unistd.h @@ -17,15 +17,15 @@ #ifndef _AC_UNISTD_H #define _AC_UNISTD_H -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif -#if HAVE_PROCESS_H +#ifdef HAVE_PROCESS_H # include #endif @@ -45,7 +45,7 @@ LDAP_LUTIL_F(char*)(lutil_getpass) LDAP_P((const char *getpass)); #endif /* getopt() defines may be in separate include file */ -#if HAVE_GETOPT_H +#ifdef HAVE_GETOPT_H # include #elif !defined(HAVE_GETOPT) diff --git a/include/ac/wait.h b/include/ac/wait.h index 705a2de41f..555e859bb0 100644 --- a/include/ac/wait.h +++ b/include/ac/wait.h @@ -19,7 +19,7 @@ #include -#if HAVE_SYS_WAIT_H +#ifdef HAVE_SYS_WAIT_H # include #endif diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index b25721af9c..934999a48c 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -311,7 +311,7 @@ LDAP_END_DECL * If none is available, unsigned long data is used. */ -#if USE_MP_BIGNUM +#ifdef USE_MP_BIGNUM /* * Use OpenSSL's BIGNUM */ @@ -337,7 +337,7 @@ typedef BIGNUM* ldap_pvt_mp_t; #define ldap_pvt_mp_clear(mp) \ do { BN_free((mp)); (mp) = 0; } while (0) -#elif USE_MP_GMP +#elif defined(USE_MP_GMP) /* * Use GNU's multiple precision library */ @@ -366,13 +366,13 @@ typedef mpz_t ldap_pvt_mp_t; * Use unsigned long long */ -#if USE_MP_LONG_LONG +#ifdef USE_MP_LONG_LONG typedef unsigned long long ldap_pvt_mp_t; #define LDAP_PVT_MP_INIT (0LL) -#elif USE_MP_LONG +#elif defined(USE_MP_LONG) typedef unsigned long ldap_pvt_mp_t; #define LDAP_PVT_MP_INIT (0L) -#elif HAVE_LONG_LONG +#elif defined(HAVE_LONG_LONG) typedef unsigned long long ldap_pvt_mp_t; #define LDAP_PVT_MP_INIT (0LL) #else diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index a828d07830..25403e16b2 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -339,7 +339,7 @@ ber_pvt_sb_do_write( Sockbuf_IO_Desc *sbiod, Sockbuf_Buf *buf_out ) int ber_pvt_socket_set_nonblock( ber_socket_t sd, int nb ) { -#if HAVE_FCNTL +#ifdef HAVE_FCNTL int flags = fcntl( sd, F_GETFL); if( nb ) { flags |= O_NONBLOCK; diff --git a/libraries/libldap_r/thr_posix.c b/libraries/libldap_r/thr_posix.c index f378cfcaf8..1531acff32 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -84,7 +84,7 @@ ldap_pvt_thread_set_concurrency(int n) { #ifdef HAVE_PTHREAD_SETCONCURRENCY return pthread_setconcurrency( n ); -#elif HAVE_THR_SETCONCURRENCY +#elif defined(HAVE_THR_SETCONCURRENCY) return thr_setconcurrency( n ); #else return 0; @@ -98,7 +98,7 @@ ldap_pvt_thread_get_concurrency(void) { #ifdef HAVE_PTHREAD_GETCONCURRENCY return pthread_getconcurrency(); -#elif HAVE_THR_GETCONCURRENCY +#elif defined(HAVE_THR_GETCONCURRENCY) return thr_getconcurrency(); #else return 0; @@ -197,10 +197,10 @@ ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return ) int ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo ) { -#if ( HAVE_PTHREAD_KILL && HAVE_PTHREADS > 6 ) +#if defined(HAVE_PTHREAD_KILL) && HAVE_PTHREADS > 6 /* MacOS 10.1 is detected as v10 but has no pthread_kill() */ return pthread_kill( thread, signo ); -#elif ( HAVE_PTHREAD_KILL && HAVE_PTHREADS > 4 ) +#elif defined(HAVE_PTHREAD_KILL) && HAVE_PTHREADS > 4 if ( pthread_kill( thread, signo ) < 0 ) return errno; return 0; #else @@ -223,7 +223,7 @@ ldap_pvt_thread_yield( void ) select( 0, NULL, NULL, NULL, &tv ); #endif return 0; -#elif HAVE_THR_YIELD +#elif defined(HAVE_THR_YIELD) thr_yield(); return 0; diff --git a/libraries/liblutil/detach.c b/libraries/liblutil/detach.c index 603c9ae2ae..eacd3fefec 100644 --- a/libraries/liblutil/detach.c +++ b/libraries/liblutil/detach.c @@ -56,7 +56,7 @@ lutil_detach( int debug, int do_close ) #ifdef HAVE_SYSCONF nbits = sysconf( _SC_OPEN_MAX ); -#elif HAVE_GETDTABLESIZE +#elif defined(HAVE_GETDTABLESIZE) nbits = getdtablesize(); #else nbits = FD_SETSIZE; @@ -70,7 +70,7 @@ lutil_detach( int debug, int do_close ) if ( debug == 0 ) { for ( i = 0; i < 5; i++ ) { -#if HAVE_THR +#ifdef HAVE_THR switch ( fork1() ) #else switch ( fork() ) diff --git a/libraries/liblutil/lockf.c b/libraries/liblutil/lockf.c index b808e6abdb..00d91dfb2f 100644 --- a/libraries/liblutil/lockf.c +++ b/libraries/liblutil/lockf.c @@ -33,12 +33,12 @@ #undef LOCK_API -#if HAVE_LOCKF && defined(F_LOCK) +#if defined(HAVE_LOCKF) && defined(F_LOCK) # define USE_LOCKF 1 # define LOCK_API "lockf" #endif -#if !defined(LOCK_API) && HAVE_FCNTL +#if !defined(LOCK_API) && defined(HAVE_FCNTL) # ifdef HAVE_FCNTL_H # include # endif @@ -48,8 +48,8 @@ # endif #endif -#if !defined(LOCK_API) && HAVE_FLOCK -# if HAVE_SYS_FILE_H +#if !defined(LOCK_API) && defined(HAVE_FLOCK) +# ifdef HAVE_SYS_FILE_H # include # endif # define USE_FLOCK 1 diff --git a/servers/slapd/alock.c b/servers/slapd/alock.c index 37d467ad12..c7bb16d56f 100644 --- a/servers/slapd/alock.c +++ b/servers/slapd/alock.c @@ -32,7 +32,7 @@ #include #include #include -#if HAVE_SYS_FILE_H +#ifdef HAVE_SYS_FILE_H #include #endif #include diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 4f4f91e1af..2aaa4d5128 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -41,7 +41,7 @@ #define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index e4e2c9e28c..8c86a02622 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1453,7 +1453,7 @@ int connection_read(ber_socket_t s) } #ifdef DATA_READY_LOOP while( !rc && ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_DATA_READY, NULL )); -#elif CONNECTION_INPUT_LOOP +#elif defined CONNECTION_INPUT_LOOP while(!rc); #else while(0); diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 704a138772..9953c6d8dc 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1434,7 +1434,7 @@ slapd_daemon_init( const char *urls ) #ifdef HAVE_SYSCONF dtblsize = sysconf( _SC_OPEN_MAX ); -#elif HAVE_GETDTABLESIZE +#elif defined(HAVE_GETDTABLESIZE) dtblsize = getdtablesize(); #else /* ! HAVE_SYSCONF && ! HAVE_GETDTABLESIZE */ dtblsize = FD_SETSIZE; @@ -2651,7 +2651,7 @@ slap_sig_shutdown( int sig ) * SIGBREAK is generated when a user logs out. */ -#if HAVE_NT_SERVICE_MANAGER && SIGBREAK +#if defined(HAVE_NT_SERVICE_MANAGER) && defined(SIGBREAK) if (is_NT_Service && sig == SIGBREAK) { /* empty */; } else diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 9dc39c9f9f..ec33cf84da 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -441,7 +441,7 @@ int main( int argc, char **argv ) while ( (i = getopt( argc, argv, "c:d:f:F:h:n:o:s:tT:V" -#if LDAP_PF_INET6 +#ifdef LDAP_PF_INET6 "46" #endif #ifdef HAVE_CHROOT @@ -686,7 +686,7 @@ unhandled_option:; #ifdef LOG_LOCAL4 openlog( logName, OPENLOG_OPTIONS, syslogUser ); -#elif LOG_DEBUG +#elif defined LOG_DEBUG openlog( logName, OPENLOG_OPTIONS ); #endif #ifdef HAVE_EBCDIC diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index e10cdac62b..aa7bcee637 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -31,7 +31,7 @@ #include #include "lutil.h" #include "slap.h" -#if SLAPD_MODULES +#ifdef SLAPD_MODULES #define LIBLTDL_DLL_IMPORT /* Win32: don't re-export libltdl's symbols */ #include #endif @@ -618,7 +618,7 @@ check_password_quality( struct berval *cred, PassPolicy *pp, LDAPPasswordPolicyE rc = LDAP_SUCCESS; if (pp->pwdCheckModule[0]) { -#if SLAPD_MODULES +#ifdef SLAPD_MODULES lt_dlhandle mod; const char *err; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index c665adc3b1..83f68c3a70 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1952,11 +1952,11 @@ LDAP_SLAPD_F (int) fe_access_allowed LDAP_P(( } while ( 0 ) #else -# if USE_MP_LONG_LONG +# ifdef USE_MP_LONG_LONG # define UI2BV_FORMAT "%llu" -# elif USE_MP_LONG +# elif defined USE_MP_LONG # define UI2BV_FORMAT "%lu" -# elif HAVE_LONG_LONG +# elif defined HAVE_LONG_LONG # define UI2BV_FORMAT "%llu" # else # define UI2BV_FORMAT "%lu" diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index 70843c731e..07bf6dc013 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -429,7 +429,7 @@ slap_tool_init( #ifdef LOG_LOCAL4 openlog( logName, OPENLOG_OPTIONS, syslogUser ); -#elif LOG_DEBUG +#elif defined LOG_DEBUG openlog( logName, OPENLOG_OPTIONS ); #endif #ifdef HAVE_EBCDIC -- 2.39.5