From 2270d8e41ff2a3688ebadceec42e9f738e13a68e Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 31 Mar 2021 01:35:02 +0200 Subject: [PATCH] up the default warning level, turn off rtti by default --- meson.build | 5 ++++- src/cs_bcode.cc | 2 +- src/cs_state.hh | 2 +- src/cs_strman.cc | 2 +- src/cs_vm.cc | 6 +++--- src/lib_str.cc | 2 +- tools/linenoise.cc | 2 +- tools/repl.cc | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 27557b5..80306fd 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,9 @@ project('libcubescript', ['cpp'], version: '0.1.0', - default_options: ['buildtype=debugoptimized', 'cpp_std=c++2a'], + default_options: [ + 'buildtype=debugoptimized', 'cpp_std=c++2a', + 'warning_level=3', 'cpp_rtti=false' + ], meson_version: '>=0.50' ) diff --git a/src/cs_bcode.cc b/src/cs_bcode.cc index 6f474da..7312ee2 100644 --- a/src/cs_bcode.cc +++ b/src/cs_bcode.cc @@ -127,7 +127,7 @@ empty_block *bcode_init_empty(internal_state *cs) { void bcode_free_empty(internal_state *cs, empty_block *empty) { std_allocator{cs}.deallocate(empty, VAL_ANY); -}; +} bcode *bcode_get_empty(empty_block *empty, std::size_t val) { return &empty[val].init + 1; diff --git a/src/cs_state.hh b/src/cs_state.hh index c19d86d..0a52695 100644 --- a/src/cs_state.hh +++ b/src/cs_state.hh @@ -20,7 +20,7 @@ struct std_allocator { inline std_allocator(internal_state *s); template - std_allocator(std_allocator const &a): istate{a.istate} {}; + std_allocator(std_allocator const &a): istate{a.istate} {} inline T *allocate(std::size_t n); inline void deallocate(T *p, std::size_t n); diff --git a/src/cs_strman.cc b/src/cs_strman.cc index 0815a81..d6c9c3a 100644 --- a/src/cs_strman.cc +++ b/src/cs_strman.cc @@ -107,7 +107,7 @@ char *string_pool::alloc_buf(std::size_t len) const { strp[len] = '\0'; /* now the user can fill it */ return strp; -}; +} /* strref implementation */ diff --git a/src/cs_vm.cc b/src/cs_vm.cc index 991f0e1..b3aabcd 100644 --- a/src/cs_vm.cc +++ b/src/cs_vm.cc @@ -8,7 +8,7 @@ namespace cubescript { -static inline void push_alias(state &cs, ident *id, ident_stack &st) { +static inline void push_alias(ident *id, ident_stack &st) { if (id->is_alias() && !(id->get_flags() & IDENT_FLAG_ARG)) { static_cast(id)->push_arg(st); } @@ -521,7 +521,7 @@ std::uint32_t *vm_exec( std::size_t idstsz = ts.idstack.size(); for (std::size_t i = 0; i < numlocals; ++i) { push_alias( - cs, args[offset + i].get_ident(), + args[offset + i].get_ident(), ts.idstack.emplace_back(*ts.pstate) ); } @@ -1144,7 +1144,7 @@ noid: std::size_t idstsz = ts.idstack.size(); for (size_t j = 0; j < size_t(callargs); ++j) { push_alias( - cs, args[offset + j].force_ident(cs), + args[offset + j].force_ident(cs), ts.idstack.emplace_back(*ts.pstate) ); } diff --git a/src/lib_str.cc b/src/lib_str.cc index 69dde3c..5bd6908 100644 --- a/src/lib_str.cc +++ b/src/lib_str.cc @@ -26,7 +26,7 @@ static inline void str_cmp_by( ); } res.set_int(integer_type(val)); -}; +} void init_lib_string(state &cs) { cs.new_command("strstr", "ss", [](auto &, auto args, auto &res) { diff --git a/tools/linenoise.cc b/tools/linenoise.cc index e5adc7d..071f547 100644 --- a/tools/linenoise.cc +++ b/tools/linenoise.cc @@ -193,7 +193,7 @@ FILE *lndebug_fp = NULL; fflush(lndebug_fp); \ } while (0) #else -#define lndebug(fmt, ...) +#define lndebug(...) #endif /* ======================= Low level terminal handling ====================== */ diff --git a/tools/repl.cc b/tools/repl.cc index 7250e57..096a6f6 100644 --- a/tools/repl.cc +++ b/tools/repl.cc @@ -196,7 +196,7 @@ static void do_sigint(int n) { } /* an example of what var printer would look like in real usage */ -static void repl_print_var(cs::state const &cs, cs::global_var const &var) { +static void repl_print_var(cs::state const &, cs::global_var const &var) { switch (var.get_type()) { case cs::ident_type::IVAR: { auto &iv = static_cast(var);