summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-30 07:07:48 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-30 07:07:48 (GMT)
commitd83536c980fb96a880def3e952eb4920815eeb51 (patch)
treeac970bbba01d5b04b4d0ab7c0175e996d7468875 /template
parent7018acc946882f21d519af7c42ccf84b22a46b27 (diff)
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 'template')
-rw-r--r--template/prelude.c.tmpl10
1 files changed, 4 insertions, 6 deletions
diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl
index a359e45..f642398 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