1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
Nobuyoshi Nakada 2021-10-27 23:57:08 +09:00 committed by GitHub
parent a6104b392a
commit 367884c659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-10-27 23:57:28 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View file

@ -1,6 +1,7 @@
// For MAP_ANONYMOUS on GNU/Linux // For MAP_ANONYMOUS on GNU/Linux
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -9,9 +10,12 @@
// This test executable doesn't compile with the rest of Ruby // This test executable doesn't compile with the rest of Ruby
// so we need to define a rb_bug(). // so we need to define a rb_bug().
_Noreturn _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(); abort();
} }
@ -71,7 +75,7 @@ void check_bytes(codeblock_t* cb, const char* bytes)
} }
} }
void run_assembler_tests() void run_assembler_tests(void)
{ {
printf("Running assembler tests\n"); printf("Running assembler tests\n");
@ -366,7 +370,7 @@ void run_assembler_tests()
printf("Assembler tests done\n"); printf("Assembler tests done\n");
} }
void assert_equal(expected, actual) void assert_equal(int expected, int actual)
{ {
if (expected != actual) { if (expected != actual) {
fprintf(stderr, "expected %d, got %d\n", expected, actual); fprintf(stderr, "expected %d, got %d\n", expected, actual);
@ -374,7 +378,7 @@ void assert_equal(expected, actual)
} }
} }
void run_runtime_tests() void run_runtime_tests(void)
{ {
printf("Running runtime tests\n"); printf("Running runtime tests\n");