Move GCC diagnostic pragma outside function call to fix build with GCC 4.2.

OK landry@
This commit is contained in:
jeremy 2018-01-25 14:34:58 +00:00
parent 69fdca21cc
commit 2d65497162
2 changed files with 47 additions and 1 deletions

View File

@ -1,9 +1,11 @@
# $OpenBSD: Makefile,v 1.1.1.1 2018/01/15 23:57:42 jeremy Exp $
# $OpenBSD: Makefile,v 1.2 2018/01/25 14:34:58 jeremy Exp $
VERSION = 2.5.0
SHARED_LIBS = ruby25 0.0
NEXTVER = 2.6
REVISION-main = 0
PSEUDO_FLAVORS= no_ri_docs bootstrap
# Do not build the RI docs on slow arches
.if ${MACHINE_ARCH:Malpha} || ${MACHINE_ARCH:Marm} || ${MACHINE_ARCH:Mhppa}

View File

@ -0,0 +1,44 @@
$OpenBSD: patch-prelude_c,v 1.1 2018/01/25 14:34:58 jeremy Exp $
Work on GCC 4.2, which doesn't allow diagnostic pragma inside functions.
Index: prelude.c
--- prelude.c.orig
+++ prelude.c
@@ -197,13 +197,13 @@ static const struct {
#define PRELUDE_STR(n) rb_usascii_str_new_static(prelude_##n.L0, sizeof(prelude_##n))
-static void
-prelude_eval(VALUE code, VALUE name, int line)
-{
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic error "-Wmissing-field-initializers"
#endif
+static void
+prelude_eval(VALUE code, VALUE name, int line)
+{
static const rb_compile_option_t optimization = {
TRUE, /* int inline_const_cache; */
TRUE, /* int peephole_optimization; */
@@ -217,9 +217,6 @@ prelude_eval(VALUE code, VALUE name, int line)
FALSE, /* unsigned int coverage_enabled; */
0, /* int debug_level; */
};
-#ifdef __GNUC__
-# pragma GCC diagnostic pop
-#endif
rb_ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
if (!ast->root) {
@@ -230,6 +227,9 @@ prelude_eval(VALUE code, VALUE name, int line)
NULL, ISEQ_TYPE_TOP, &optimization));
rb_ast_dispose(ast);
}
+#ifdef __GNUC__
+# pragma GCC diagnostic pop
+#endif
void
Init_prelude(void)