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
This commit is contained in:
shyouhei 2018-07-30 07:07:48 +00:00
parent 7018acc946
commit d83536c980
7 changed files with 61 additions and 38 deletions

15
dln.c
View file

@ -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*