ruby-changes:69478
From: Nobuyoshi <ko1@a...>
Date: Wed, 27 Oct 2021 23:57:19 +0900 (JST)
Subject: [ruby-changes:69478] 367884c659 (master): Fix yjit_asm_tests.c as C99 compliant (#5033)
https://git.ruby-lang.org/ruby.git/commit/?id=367884c659 From 367884c65912b3305d18f74b84b7c9e396d14161 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 27 Oct 2021 23:57:08 +0900 Subject: Fix yjit_asm_tests.c as C99 compliant (#5033) * rb_bug should be variadic * Prefer ANSI-style prototypes over old K&R-style definitions * Add missing argument types --- misc/yjit_asm_tests.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/misc/yjit_asm_tests.c b/misc/yjit_asm_tests.c index 7650505fb37..0bd11e47528 100644 --- a/misc/yjit_asm_tests.c +++ b/misc/yjit_asm_tests.c @@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/misc/yjit_asm_tests.c#L1 // For MAP_ANONYMOUS on GNU/Linux #define _GNU_SOURCE 1 +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -9,9 +10,12 @@ https://github.com/ruby/ruby/blob/trunk/misc/yjit_asm_tests.c#L10 // This test executable doesn't compile with the rest of Ruby // so we need to define a rb_bug(). _Noreturn -static void rb_bug(char *message) +static void rb_bug(const char *message, ...) { - fprintf(stderr, "%s\n", message); + va_list args; + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); abort(); } @@ -71,7 +75,7 @@ void check_bytes(codeblock_t* cb, const char* bytes) https://github.com/ruby/ruby/blob/trunk/misc/yjit_asm_tests.c#L75 } } -void run_assembler_tests() +void run_assembler_tests(void) { printf("Running assembler tests\n"); @@ -366,7 +370,7 @@ void run_assembler_tests() https://github.com/ruby/ruby/blob/trunk/misc/yjit_asm_tests.c#L370 printf("Assembler tests done\n"); } -void assert_equal(expected, actual) +void assert_equal(int expected, int actual) { if (expected != actual) { fprintf(stderr, "expected %d, got %d\n", expected, actual); @@ -374,7 +378,7 @@ void assert_equal(expected, actual) https://github.com/ruby/ruby/blob/trunk/misc/yjit_asm_tests.c#L378 } } -void run_runtime_tests() +void run_runtime_tests(void) { printf("Running runtime tests\n"); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/