~emersion/mrsh

f7b0e901805a40db9fb7d4e460e1c78e30bf64b6 — emersion 2 years ago b4f54a1
meson: enable more compiler warnings
3 files changed, 23 insertions(+), 10 deletions(-)

M builtin/cd.c
M frontend/readline.c
M meson.build
M builtin/cd.c => builtin/cd.c +2 -4
@@ 113,11 113,9 @@ int builtin_cd(struct mrsh_state *state, int argc, char *argv[]) {
			char path[PATH_MAX];
			if (slash == NULL || slash[1] != '\0') {
				// the last character is not a slash
				len = snprintf(path, PATH_MAX, "%s/%s", c,
					curpath);
				len = snprintf(path, PATH_MAX, "%s/%s", c, curpath);
			} else {
				len = snprintf(path, PATH_MAX, "%s%s", c,
					curpath);
				len = snprintf(path, PATH_MAX, "%s%s", c, curpath);
			}
			if (len >= PATH_MAX) {
				fprintf(stderr, "cd: Cannot search $CDPATH "

M frontend/readline.c => frontend/readline.c +1 -1
@@ 15,7 15,7 @@
#endif
#include "frontend.h"

static const char *get_history_path() {
static const char *get_history_path(void) {
	static char history_path[PATH_MAX + 1];
	snprintf(history_path, sizeof(history_path),
			"%s/.mrsh_history", getenv("HOME"));

M meson.build => meson.build +20 -5
@@ 6,18 6,33 @@ project(
	meson_version: '>=0.46.0',
	default_options: [
		'c_std=c99',
		'warning_level=2',
		'warning_level=3',
		'werror=true',
	],
)

add_project_arguments([
cc = meson.get_compiler('c')

add_project_arguments(cc.get_supported_arguments([
	'-Wundef',
	'-Wlogical-op',
	'-Wmissing-include-dirs',
	'-Wold-style-definition',
	'-Wpointer-arith',
	'-Winit-self',
	'-Wfloat-equal',
	'-Wstrict-prototypes',
	'-Wredundant-decls',
	'-Wimplicit-fallthrough=5',
	'-Wendif-labels',
	'-Wstrict-aliasing=2',
	'-Woverflow',
	'-Wformat=2',

	'-Wno-missing-braces',
	'-Wno-missing-field-initializers',
	'-Wno-unused-parameter',
], language: 'c')

cc = meson.get_compiler('c')
]), language: 'c')

if get_option('readline') != 'disabled'
	if get_option('readline-provider') == 'readline'