Commit bbc719ca authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

ITS#4948: '#if <undefined macro>' -> '#ifdef' warning cleanup

parent f886eaa5
......@@ -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();
......
......@@ -13,10 +13,10 @@
#ifndef _AC_TIME_H
#define _AC_TIME_H
#if TIME_WITH_SYS_TIME
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#elif HAVE_SYS_TIME_H
#elif defined HAVE_SYS_TIME_H
# include <sys/time.h>
# ifdef HAVE_SYS_TIMEB_H
# include <sys/timeb.h>
......
......@@ -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
......
......@@ -26,7 +26,7 @@
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# if HAVE_ALLOCA_H
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
......
......@@ -20,7 +20,7 @@
#include <ac/unistd.h>
/* crypt() may be defined in a separate include file */
#if HAVE_CRYPT_H
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#else
extern char *(crypt)();
......
......@@ -17,7 +17,7 @@
#ifndef _AC_DIRENT_H
#define _AC_DIRENT_H
#if HAVE_DIRENT_H
#ifdef HAVE_DIRENT_H
# include <dirent.h>
# 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 <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
......
......@@ -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[];
......
......@@ -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__
......
......@@ -17,10 +17,10 @@
#ifndef _AC_TIME_H
#define _AC_TIME_H
#if TIME_WITH_SYS_TIME
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#elif HAVE_SYS_TIME_H
#elif defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
# ifdef HAVE_SYS_TIMEB_H
# include <sys/timeb.h>
......
......@@ -17,15 +17,15 @@
#ifndef _AC_UNISTD_H
#define _AC_UNISTD_H
#if HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_PROCESS_H
#ifdef HAVE_PROCESS_H
# include <process.h>
#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 <getopt.h>
#elif !defined(HAVE_GETOPT)
......
......@@ -19,7 +19,7 @@
#include <sys/types.h>
#if HAVE_SYS_WAIT_H
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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() )
......
......@@ -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 <fcntl.h>
# 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 <sys/file.h>
# endif
# define USE_FLOCK 1
......
......@@ -32,7 +32,7 @@
#include <ac/assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_SYS_FILE_H
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#include <fcntl.h>
......
......@@ -41,7 +41,7 @@
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#if HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
......
......@@ -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);
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment