consistently output WARN_SLOW information on stderr

This commit is contained in:
dzaima 2022-09-12 20:12:32 +03:00
parent 89503ba1c1
commit 9c5396e711
3 changed files with 11 additions and 2 deletions

View File

@ -348,6 +348,14 @@ NOINLINE B make_fmt(char* p, ...) {
va_end(a);
return r;
}
NOINLINE void fprint_fmt(FILE* f, char* p, ...) {
va_list a;
va_start(a, p);
B r = do_fmt(emptyCVec(), p, a);
va_end(a);
fprintRaw(f, r);
decG(r);
}
NOINLINE void print_fmt(char* p, ...) {
va_list a;
va_start(a, p);
@ -831,7 +839,7 @@ void g_pst(void) { vm_pstLive(); fflush(stdout); fflush(stderr); }
#endif
#if WARN_SLOW==1
static void warn_ln(B x) {
if (isArr(x)) print_fmt("%s items, %S, shape=%H\n", IA(x), eltype_repr(TI(x,elType)), x);
if (isArr(x)) fprint_fmt(stderr, "%s items, %S, shape=%H\n", IA(x), eltype_repr(TI(x,elType)), x);
else {
fprintf(stderr, "atom: ");
fprintRaw(stderr, x = bqn_fmt(inc(x))); dec(x);

View File

@ -156,6 +156,7 @@ i32 num_fmt(char buf[30], f64 x);
B append_fmt(B s, char* p, ...);
B make_fmt(char* p, ...);
void print_fmt(char* p, ...);
void fprint_fmt(FILE* f, char* p, ...);
#define AJOIN(X) s = vec_join(s,X) // consumes X
#define AOBJ(X) s = vec_addN(s,X) // consumes X
#define ACHR(X) AOBJ(m_c32(X))

View File

@ -9,6 +9,7 @@ make heapverify && ./BQN -p 2+2 || exit
make rtverify && ./BQN -p 2+2 || exit
make rtperf && ./BQN -p 2+2 | head -2 || exit
make f='-DDEBUG -DDEBUG_VM' c && ./BQN -p 2+2 | tail -2 || exit
make f='-DWARN_SLOW' c && ./BQN -p 2+2 2> /dev/null || exit
make f='-DMM=0 -DENABLE_GC=0' c && ./BQN -p 2+2 || exit
make f='-DMM=1' c && ./BQN -p 2+2 || exit
make f='-DMM=2' c && ./BQN -p 2+2 || exit
@ -27,7 +28,6 @@ make f='-DLOG_GC' c && ./BQN -p 2+2 || exit
make f='-DWRITE_ASM' c && ./BQN -p 2+2 || exit
make f='-DUSE_PERF' c && ./BQN -p 2+2 || exit
make f='-DUSZ_64' c && ./BQN -p 2+2 || exit
make f='-DWARN_SLOW' c && ./BQN -p 2+2 || exit
make f='-DREPL_INTERRUPT=0' c && ./BQN -p 2+2 || exit
make f='-DREPL_INTERRUPT=1' c && ./BQN -p 2+2 || exit
make FFI=0 c && ./BQN -p 2+2 || exit