From cb5f68994fbe43ebaf3c06361ae7e793aef8892c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 20 Jun 2021 12:47:38 -0500 Subject: [PATCH] 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() --- modules/ca/src/client/caRepeater.cpp | 2 +- modules/ca/src/perl/Cap5.xs | 8 ++++---- modules/libcom/src/osi/os/posix/osdThread.c | 7 ++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/ca/src/client/caRepeater.cpp b/modules/ca/src/client/caRepeater.cpp index 7eaab508b..c8385ba3b 100644 --- a/modules/ca/src/client/caRepeater.cpp +++ b/modules/ca/src/client/caRepeater.cpp @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) (void)detachinout; #endif - chdir ( "/" ); + (void)! chdir ( "/" ); ca_repeater (); return ( 0 ); } diff --git a/modules/ca/src/perl/Cap5.xs b/modules/ca/src/perl/Cap5.xs index cc729340a..6d06a15f1 100644 --- a/modules/ca/src/perl/Cap5.xs +++ b/modules/ca/src/perl/Cap5.xs @@ -606,12 +606,12 @@ void CA_put(SV *ca_ref, SV *val, ...) { } } else { union { + void *dbr; dbr_char_t *dbr_char; dbr_long_t *dbr_long; dbr_double_t *dbr_double; char *dbr_string; - void *dbr; - } p; + } p = {0}; int i; chtype type = best_type(pch); @@ -699,12 +699,12 @@ void CA_put_callback(SV *ca_ref, SV *sub, SV *val, ...) { } } else { union { + void *dbr; dbr_char_t *dbr_char; dbr_long_t *dbr_long; dbr_double_t *dbr_double; char *dbr_string; - void *dbr; - } p; + } p = {0}; int i; chtype type = best_type(pch); diff --git a/modules/libcom/src/osi/os/posix/osdThread.c b/modules/libcom/src/osi/os/posix/osdThread.c index 50bb714e0..61a67f62c 100644 --- a/modules/libcom/src/osi/os/posix/osdThread.c +++ b/modules/libcom/src/osi/os/posix/osdThread.c @@ -24,7 +24,12 @@ #include #include -#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 #endif