Skip to content
Snippets Groups Projects
Commit 07c5ae3c authored by Christian Mehlis's avatar Christian Mehlis
Browse files

Merge pull request #664 from Kijewski/conditional-fno-delete-null-pointer-checks

clang does not know fno-delete-null-pointer-checks
parents 44ee27a9 012fb5f9
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,19 @@ endif ...@@ -14,7 +14,19 @@ endif
# if you want to publish the board into the sources as an uppercase #define # if you want to publish the board into the sources as an uppercase #define
BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z') BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z')
CPUDEF = $(shell echo $(CPU)|tr 'a-z' 'A-Z') CPUDEF = $(shell echo $(CPU)|tr 'a-z' 'A-Z')
CFLAGS += -DBOARD=$(BB) -DCPU_$(CPUDEF) -fno-delete-null-pointer-checks CFLAGS += -DBOARD=$(BB) -DCPU_$(CPUDEF)
# Add `-fno-delete-null-pointer-checks` flag iff the compiler supports it.
# GCC removes moves tests whether `x == NULL`, if previously `x` or even `x->y` was accessed.
# 0x0 might be a sane memory location for embedded systems, so the test must not be removed.
# Right now clang does not use the *delete-null-pointer* optimization, and does not understand the parameter.
# Related issues: #628, #664.
ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
ifeq ($(shell LANG=C $(CC) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
CFLAGS += -fno-delete-null-pointer-checks
endif
endif
export CFLAGS export CFLAGS
export BINDIR =$(CURDIR)/bin/$(BOARD)/ export BINDIR =$(CURDIR)/bin/$(BOARD)/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment