build: Use #ifdef to check for #defines

for example, in case HAVE_MEMFD is #undef, checking with #if HAVE_MEMFD
gives a warning (gcc 5.4.1, Ubuntu)

pulsecore/shm.c: In function 'sharedmem_create':
pulsecore/shm.c:208:5: warning: "HAVE_MEMFD" is not defined [-Wundef]
 #if HAVE_MEMFD

use #ifdef or #if defined() to check for presence of a #define

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald-Stadler 2017-03-07 16:29:30 +01:00
parent 48ba5e4957
commit a199b9045e
4 changed files with 8 additions and 8 deletions

View file

@ -220,7 +220,7 @@ static void io_event_cb(pa_mainloop_api *mainloop, pa_io_event *e, int fd, pa_io
unsigned int flags = 0;
DBusWatch *watch = userdata;
#if HAVE_DBUS_WATCH_GET_UNIX_FD
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
pa_assert(fd == dbus_watch_get_unix_fd(watch));
#else
pa_assert(fd == dbus_watch_get_fd(watch));
@ -291,7 +291,7 @@ static dbus_bool_t watch_add_cb(DBusWatch *watch, void *data) {
ev = mainloop->io_new(
mainloop,
#if HAVE_DBUS_WATCH_GET_UNIX_FD
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
dbus_watch_get_unix_fd(watch),
#else
dbus_watch_get_fd(watch),

View file

@ -100,7 +100,7 @@ static void handle_io_event(pa_mainloop_api *ea, pa_io_event *e, int fd, pa_io_e
unsigned int flags = 0;
DBusWatch *watch = userdata;
#if HAVE_DBUS_WATCH_GET_UNIX_FD
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
pa_assert(fd == dbus_watch_get_unix_fd(watch));
#else
pa_assert(fd == dbus_watch_get_fd(watch));
@ -153,7 +153,7 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
ev = c->mainloop->io_new(
c->mainloop,
#if HAVE_DBUS_WATCH_GET_UNIX_FD
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
dbus_watch_get_unix_fd(watch),
#else
dbus_watch_get_fd(watch),

View file

@ -205,7 +205,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m
pa_assert_se(pa_close(fd) == 0);
m->fd = -1;
}
#if HAVE_MEMFD
#ifdef HAVE_MEMFD
else
m->fd = fd;
#endif

View file

@ -2285,7 +2285,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
break;
}
#if HAVE_DECL_SOUND_PCM_READ_RATE
#ifdef HAVE_DECL_SOUND_PCM_READ_RATE
case SOUND_PCM_READ_RATE:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n");
@ -2295,7 +2295,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
break;
#endif
#if HAVE_DECL_SOUND_PCM_READ_CHANNELS
#ifdef HAVE_DECL_SOUND_PCM_READ_CHANNELS
case SOUND_PCM_READ_CHANNELS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_CHANNELS\n");
@ -2305,7 +2305,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
break;
#endif
#if HAVE_DECL_SOUND_PCM_READ_BITS
#ifdef HAVE_DECL_SOUND_PCM_READ_BITS
case SOUND_PCM_READ_BITS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_BITS\n");