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 --- template/prelude.c.tmpl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'template') diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl index a359e45cf8..f642398921 100644 --- a/template/prelude.c.tmpl +++ b/template/prelude.c.tmpl @@ -138,9 +138,9 @@ prelude_prefix_path(VALUE self) % unless preludes.empty? #define PRELUDE_NAME(n) rb_usascii_str_new_static(prelude_name##n, sizeof(prelude_name##n)-1) #define PRELUDE_CODE(n) rb_usascii_str_new_static(prelude_code##n.L0, sizeof(prelude_code##n)) -#if defined __GNUC__ && __GNUC__ >= 5 -# pragma GCC diagnostic push -# pragma GCC diagnostic error "-Wmissing-field-initializers" +COMPILER_WARNING_PUSH +#if GCC_VERSION_SINCE(4, 2, 0) +COMPILER_WARNING_ERROR(-Wmissing-field-initializers) #endif static void prelude_eval(VALUE code, VALUE name, int line) @@ -168,9 +168,7 @@ prelude_eval(VALUE code, VALUE name, int line) NULL, ISEQ_TYPE_TOP, &optimization)); rb_ast_dispose(ast); } -#if defined __GNUC__ && __GNUC__ >= 5 -# pragma GCC diagnostic pop -#endif +COMPILER_WARNING_POP % end % if @have_sublib -- cgit v1.2.3