Commit 4993684bb42968cfacd1b66d59d8c7de3b81461a

humphreyj 2018-10-07T09:12:54

Move UBSan to clang compile target and run that as a separate test.

diff --git a/Makefile b/Makefile
index 0518ccb..267e497 100644
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,8 @@ CFLAGS.debug   += -g3
 CFLAGS.debug   += -DSMTP_TEST
 CFLAGS.debug   += -Wno-missing-prototypes
 CFLAGS.debug   += -fprofile-arcs -ftest-coverage
-CFLAGS.debug   += -fsanitize=undefined
+
+CFLAGS.clang   += -fsanitize=undefined
 
 CFLAGS.release += $(CFLAGS)
 CFLAGS.release += -O3
@@ -96,10 +97,9 @@ CPPFLAGS += -fpermissive
 
 CPPFLAGS.release = $(CPPFLAGS)
 
-CFLAGS.gcc.debug     += $(CFLAGS.debug)   $(CWARN.gcc)
+CFLAGS.gcc.debug     += $(CFLAGS.debug) $(CWARN.gcc)
 CFLAGS.gcc.release   += $(CFLAGS.release) $(CWARN.gcc)
-CFLAGS.clang.debug   += $(CFLAGS.debug)   $(CWARN.clang)
-CFLAGS.clang.release += $(CFLAGS.release) $(CWARN.clang)
+CFLAGS.clang.debug   += $(CFLAGS.debug) $(CFLAGS.clang) $(CWARN.clang)
 
 VFLAGS += -q
 VFLAGS += --error-exitcode=1
@@ -171,6 +171,7 @@ install: all
 test: all       \
       test_unit
 	$(VALGRIND_MEMCHECK) $(BDIR)/debug/test
+	$(VALGRIND_MEMCHECK) $(BDIR)/debug/clang_test
 	$(VALGRIND_MEMCHECK) $(BDIR)/release/test_nossl
 	$(BDIR)/release/test_cpp_wrapper
 
@@ -246,7 +247,7 @@ $(BDIR)/release/smtp.o: src/smtp.c | $(BDIR)/release
 $(BDIR)/debug/test: $(BDIR)/debug/seams.o \
                     $(BDIR)/debug/smtp.o  \
                     $(BDIR)/debug/test.o
-	$(LINK.c.debug) -lssl -lcrypto -lgcov -lubsan
+	$(LINK.c.debug) -lssl -lcrypto -lgcov
 
 $(BDIR)/debug/test.o: test/test.c | $(BDIR)/debug
 	$(COMPILE.c.debug) -Isrc/