From d83536c980fb96a880def3e952eb4920815eeb51 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 30 Jul 2018 07:07:48 +0000 Subject: reduce copy & paste We see several occurrence of "diagnostic push/pop" so why not make them macros. Tested on GCC8 / Clang 6. Note that ruby.h is intentionally left untouched because we don't want to introduce new public macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dln.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'dln.c') diff --git a/dln.c b/dln.c index 6791578063..7acea5f888 100644 --- a/dln.c +++ b/dln.c @@ -1244,12 +1244,9 @@ rb_w32_check_imported(HMODULE ext, HMODULE mine) #endif #ifdef USE_DLN_DLOPEN -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpedantic" -#elif defined(__GNUC__) && (__GNUC__ >= 5) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" +COMPILER_WARNING_PUSH +#if defined(__clang__) || GCC_VERSION_SINCE(4, 2, 0) +COMPILER_WARNING_IGNORED(-Wpedantic) #endif static bool dln_incompatible_library_p(void *handle) @@ -1257,11 +1254,7 @@ dln_incompatible_library_p(void *handle) void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc"); return ex && ex != ruby_xmalloc; } -#ifdef __clang__ -#pragma clang diagnostic pop -#elif defined(__GNUC__) && (__GNUC__ >= 5) -#pragma GCC diagnostic pop -#endif +COMPILER_WARNING_POP #endif void* -- cgit v1.2.1