Squish various compiler warnings

* CPP's defined() is UB outside of a #if line
* Use (void)! cast to prevent recent GCCs & glibc from warning
  about ignoring the return status from chdir()
This commit is contained in:
Andrew Johnson
2021-06-20 12:47:38 -05:00
parent ac6eb5e212
commit cb5f68994f
3 changed files with 11 additions and 6 deletions
+6 -1
View File
@@ -24,7 +24,12 @@
#include <sched.h>
#include <unistd.h>
#define USE_MEMLOCK (defined(_POSIX_MEMLOCK) && (_POSIX_MEMLOCK > 0) && !defined(__rtems__))
#if (defined(_POSIX_MEMLOCK) && (_POSIX_MEMLOCK > 0) && !defined(__rtems__))
# define USE_MEMLOCK 1
#else
# define USE_MEMLOCK 0
#endif
#if USE_MEMLOCK
#include <sys/mman.h>
#endif