summaryrefslogtreecommitdiff
path: root/yjit_asm_tests.c
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2021-10-19 16:43:20 -0400
committerAlan Wu <[email protected]>2021-10-20 18:19:43 -0400
commit00be5846e4793b718da19dafec3f4ecf2d6d0692 (patch)
treec22f1e3bf830119d67a583f7890df9acc5c48fa3 /yjit_asm_tests.c
parentcffa1162758a67dd73da6cd911d593f67f05ea7b (diff)
Fix non RUBY_DEBUG build warnings
On non RUBY_DEBUG builds, assert() compiles to nothing and the compiler warns about uninitialized variables in those code paths. Replace those asserts with rb_bug() to fix the warnings and do the assert in all builds. Since yjit_asm_tests.c compiles outside of Ruby, it needed a distinct version of rb_bug(). Also put YJIT_STATS check for function delcaration that is only defined in YJIT_STATS builds.
Diffstat (limited to 'yjit_asm_tests.c')
-rw-r--r--yjit_asm_tests.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/yjit_asm_tests.c b/yjit_asm_tests.c
index 5f2376127c..295edb86e5 100644
--- a/yjit_asm_tests.c
+++ b/yjit_asm_tests.c
@@ -6,6 +6,15 @@
#include <string.h>
#include <assert.h>
+// 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)
+{
+ fprintf(stderr, "%s\n", message);
+ abort();
+}
+
#include "yjit_asm.c"
// Print the bytes in a code block