From ed9ca0b7bd1a13185eb4b1feb11b87b296b111bc Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 7 Mar 2021 16:44:54 +0100 Subject: [PATCH] build: add address sanitizer make target (#9044) --- Makefile | 34 +++++++--------------------------- vlib/v/util/util.v | 2 +- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 13b33a652c..91f67d3146 100644 --- a/Makefile +++ b/Makefile @@ -73,36 +73,21 @@ endif .PHONY: all clean fresh_vc fresh_tcc +ifdef prod +VFLAGS+=-prod +endif + all: latest_vc latest_tcc ifdef WIN32 $(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) -ifdef prod - $(V) -prod self -else $(V) self -endif else $(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) -ifdef ANDROID - chmod 755 v -endif - -ifdef prod - $(V) -prod self -else $(V) self -endif - -ifndef ANDROID - $(MAKE) modules -endif endif @echo "V has been successfully built" @$(V) -version -#clean: clean_tmp -#git clean -xf - clean: rm -rf $(TMPTCC) rm -rf $(VC) @@ -143,16 +128,11 @@ $(TMPTCC)/.git/config: $(VC)/.git/config: $(MAKE) fresh_vc +asan: + $(MAKE) all CFLAGS='-fsanitize=address,undefined' + selfcompile: $(V) -cg -o v cmd/v selfcompile-static: $(V) -cg -cflags '--static' -o v-static cmd/v - -modules: module_builtin module_strings module_strconv -module_builtin: - #$(V) build module vlib/builtin > /dev/null -module_strings: - #$(V) build module vlib/strings > /dev/null -module_strconv: - #$(V) build module vlib/strconv > /dev/null diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index dbf83fb14e..ff5260e006 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -406,7 +406,7 @@ pub fn join_env_vflags_and_os_args() []string { } return non_empty(args) } - return non_empty(os.args) + return os.args } fn non_empty(arg []string) []string {