diff --git a/CMakeLists.txt b/CMakeLists.txt index 658f537..8d0fa01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,12 @@ add_executable(ink_exe main.c) target_link_libraries(ink_exe PUBLIC ink) target_include_directories(ink PUBLIC include) +if(MSVC) + target_compile_options(ink PRIVATE /W4 /WX) +else() + target_compile_options(ink PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() + # Benchmark is broken since the addition to coroutines # add_executable(ink_bench bench.c) # target_link_libraries(ink_bench PUBLIC ink) diff --git a/lib.c b/lib.c index 34c26ee..9d3915a 100644 --- a/lib.c +++ b/lib.c @@ -355,7 +355,7 @@ struct context* ink_make_default_context(void) { } #endif -static int ink_consume_one(int* end, struct context* pContext, char** buffer, char* r) { +static int ink_consume_one(int* end, struct context* pContext, char* r) { int i; int done; struct elem value; @@ -471,7 +471,7 @@ restart_after_comment: end = 0; goto restart_after_comment; } - err = ink_consume_one(&end, pContext, &buffer, r); + err = ink_consume_one(&end, pContext, r); if(err < 0) { pContext->panic = 1; return -8; @@ -482,7 +482,7 @@ restart_after_comment: } ++buffer; } - err = ink_consume_one(&end, pContext, &buffer, r); + err = ink_consume_one(&end, pContext, r); if(err < 0) { pContext->panic = 1; return -9; @@ -1328,7 +1328,7 @@ static void lte_int(struct context* ctx) { currentRoutine->stack[currentRoutine->top-1].value = b.value <= a.value; } -#endif // NOEXTRAARITHMETIC +#endif /* NOEXTRAARITHMETIC */ static void lt_int(struct context* ctx) { struct ink_routine* currentRoutine; @@ -1559,9 +1559,9 @@ static void dump_stack(struct context* ctx) { return; } -static void collect_noop(struct context* _1, void* _2) {} +static void collect_noop() {} -static struct ink_collection_list gc_noop(struct context* _1, void* _2) { +static struct ink_collection_list gc_noop() { struct ink_collection_list c; c.elements = NULL; c.count = 0; @@ -1674,7 +1674,6 @@ static void push_delimited_array(struct context* ctx) { ary= ink_get_value(ctx, a); for(idx = 1; idx <= currentRoutine->top; ++idx) { - struct elem maybe_delim; if(currentRoutine->stack[currentRoutine->top-idx].type == tid) { break; } @@ -1822,7 +1821,6 @@ static void is_array(struct context* ctx) { } static void is_int(struct context* ctx) { - int tid; struct ink_routine *currentRoutine; struct elem a; @@ -1843,7 +1841,6 @@ static void print_array_of_codepoints(struct context* ctx) { struct ink_routine *currentRoutine; struct elem a; struct ink_array *ary; - struct elem idx; tid = get_type_by_name(ctx, "array"); currentRoutine = ctx->routines + ctx->routine_current; @@ -1892,7 +1889,7 @@ static void arrayify_stack(struct context* ctx) { return; } -#endif // NOARRAYLIB +#endif /* NOARRAYLIB */ int ink_std_library(struct context* ctx) { int v; @@ -1923,7 +1920,7 @@ int ink_std_library(struct context* ctx) { v += ink_add_native(ctx, "=<", lte_int); v += ink_add_native(ctx, "%", rem_int); v += ink_add_native(ctx, "int.xor", xor_int); -#endif // NOEXTRAARITHMETIC +#endif /* NOEXTRAARITHMETIC */ #ifndef NOARRAYLIB ink_new_type(ctx, "array", sizeof(struct ink_array), collect_array, gc_array); ink_new_type(ctx, "array_marker", 0, collect_noop, gc_noop); @@ -1937,7 +1934,7 @@ int ink_std_library(struct context* ctx) { v += ink_add_native(ctx, "array.print_utf8", print_array_of_codepoints); v += ink_add_native(ctx, "is.array", is_array); v += ink_add_native(ctx, "stack.to_array", arrayify_stack); -#endif // NOARRAYLIB +#endif /* NOARRAYLIB */ return v; }