aboutsummaryrefslogtreecommitdiffstats
path: root/dln.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-30 07:07:48 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-30 07:07:48 +0000
commitd83536c980fb96a880def3e952eb4920815eeb51 (patch)
treeac970bbba01d5b04b4d0ab7c0175e996d7468875 /dln.c
parent7018acc946882f21d519af7c42ccf84b22a46b27 (diff)
downloadruby-d83536c980fb96a880def3e952eb4920815eeb51.tar.gz
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
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c15
1 files changed, 4 insertions, 11 deletions
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*