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 --- process.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 5ac18315ef..ec6bbf8da5 100644 --- a/process.c +++ b/process.c @@ -3972,9 +3972,9 @@ retry_fork_async_signal_safe(int *status, int *ep, while (1) { prefork(); disable_child_handler_before_fork(&old); + COMPILER_WARNING_PUSH; #ifdef __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" + COMPILER_WARNING_IGNORED(-Wdeprecated-declarations); #endif #ifdef HAVE_WORKING_VFORK if (!has_privilege()) @@ -3984,9 +3984,7 @@ retry_fork_async_signal_safe(int *status, int *ep, #else pid = fork(); #endif -#ifdef __GNUC__ -# pragma GCC diagnostic pop -#endif + COMPILER_WARNING_POP; if (pid == 0) {/* fork succeed, child process */ int ret; close(ep[0]); @@ -4055,13 +4053,13 @@ rb_fork_ruby(int *status) prefork(); disable_child_handler_before_fork(&old); before_fork_ruby(); + COMPILER_WARNING_PUSH; #ifdef __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" + COMPILER_WARNING_IGNORED(-Wdeprecated-declarations); #endif pid = fork(); #ifdef __GNUC__ -# pragma GCC diagnostic pop + COMPILER_WARNING_POP; #endif err = errno; after_fork_ruby(); -- cgit v1.2.3