diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-04-29 15:12:44 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-05-04 14:56:55 +0200 |
commit | 0764d323d8908c1682f3ab654c48783438a88a54 (patch) | |
tree | e335e7f8f9c3a4d8a6c14bdce81af07102244ad7 | |
parent | fa7a712d460dc904f8a836bb22b54d457d95ba8e (diff) |
Fix -Wundef warnings for patterns `#if HAVE`
* See [Feature #17752]
* Using this to detect them:
git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF'
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4428
-rw-r--r-- | dir.c | 6 | ||||
-rw-r--r-- | ext/bigdecimal/missing.h | 2 | ||||
-rw-r--r-- | ext/psych/yaml/yaml_private.h | 2 | ||||
-rw-r--r-- | gc.c | 4 | ||||
-rw-r--r-- | random.c | 2 | ||||
-rw-r--r-- | signal.c | 2 | ||||
-rw-r--r-- | siphash.c | 4 | ||||
-rw-r--r-- | strftime.c | 2 | ||||
-rw-r--r-- | thread_pthread.c | 4 |
9 files changed, 14 insertions, 14 deletions
@@ -50,13 +50,13 @@ # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # define HAVE_DIRENT_NAMLEN 1 -# 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 # ifdef _WIN32 diff --git a/ext/bigdecimal/missing.h b/ext/bigdecimal/missing.h index 11b58c099d..7969849158 100644 --- a/ext/bigdecimal/missing.h +++ b/ext/bigdecimal/missing.h @@ -45,7 +45,7 @@ extern "C" { # if __has_builtin(__builtin_unreachable) # define UNREACHABLE __builtin_unreachable() -# elif HAVE___ASSUME +# elif defined(HAVE___ASSUME) # define UNREACHABLE __assume(0) # else diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h index 6c674de147..266a6bd3a7 100644 --- a/ext/psych/yaml/yaml_private.h +++ b/ext/psych/yaml/yaml_private.h @@ -2,7 +2,7 @@ #include RUBY_EXTCONF_H #endif -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -45,7 +45,7 @@ #ifdef HAVE_MALLOC_USABLE_SIZE # ifdef RUBY_ALTERNATIVE_MALLOC_HEADER # include RUBY_ALTERNATIVE_MALLOC_HEADER -# elif HAVE_MALLOC_H +# elif defined(HAVE_MALLOC_H) # include <malloc.h> # elif defined(HAVE_MALLOC_NP_H) # include <malloc_np.h> @@ -381,7 +381,7 @@ static ruby_gc_params_t gc_params = { #endif #if RGENGC_DEBUG < 0 && !defined(_MSC_VER) # define RGENGC_DEBUG_ENABLED(level) (-(RGENGC_DEBUG) >= (level) && ruby_rgengc_debug >= (level)) -#elif HAVE_VA_ARGS_MACRO +#elif defined(HAVE_VA_ARGS_MACRO) # define RGENGC_DEBUG_ENABLED(level) ((RGENGC_DEBUG) >= (level)) #else # define RGENGC_DEBUG_ENABLED(level) 0 @@ -428,7 +428,7 @@ random_init(int argc, VALUE *argv, VALUE obj) # define USE_DEV_URANDOM 0 #endif -#if HAVE_GETENTROPY +#ifdef HAVE_GETENTROPY # define MAX_SEED_LEN_PER_READ 256 static int fill_random_bytes_urandom(void *seed, size_t size) @@ -29,7 +29,7 @@ # include <ucontext.h> #endif -#if HAVE_PTHREAD_H +#ifdef HAVE_PTHREAD_H # include <pthread.h> #endif @@ -180,7 +180,7 @@ int_sip_dump(sip_state *state) int v; for (v = 0; v < 4; v++) { -#if HAVE_UINT64_T +#ifdef HAVE_UINT64_T printf("v%d: %" PRIx64 "\n", v, state->v[v]); #else printf("v%d: %" PRIx32 "%.8" PRIx32 "\n", v, state->v[v].hi, state->v[v].lo); @@ -447,7 +447,7 @@ sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len) OR_BYTE(4); case 4: #if BYTE_ORDER == LITTLE_ENDIAN && UNALIGNED_WORD_ACCESS - #if HAVE_UINT64_T + #ifdef HAVE_UINT64_T last |= (uint64_t) ((uint32_t *) end)[0]; #else last.lo |= ((uint32_t *) end)[0]; diff --git a/strftime.c b/strftime.c index d963038d94..17cfed1dda 100644 --- a/strftime.c +++ b/strftime.c @@ -59,7 +59,7 @@ #endif #if defined(TM_IN_SYS_TIME) || !defined(GAWK) #include <sys/types.h> -#if HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif #endif diff --git a/thread_pthread.c b/thread_pthread.c index 8149ee57f5..3e0c78b256 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -20,9 +20,9 @@ #ifdef HAVE_THR_STKSEGMENT #include <thread.h> #endif -#if HAVE_FCNTL_H +#if defined(HAVE_FCNTL_H) #include <fcntl.h> -#elif HAVE_SYS_FCNTL_H +#elif defined(HAVE_SYS_FCNTL_H) #include <sys/fcntl.h> #endif #ifdef HAVE_SYS_PRCTL_H |