Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Description: save resources by not making/testing the -fsantize variants
--- bowtie2.orig/Makefile
+++ bowtie2/Makefile
@@ -213,20 +213,6 @@
 DEBUG_DEFS     = -DCOMPILER_OPTIONS="\"$(filter-out -fdebug-prefix-map=%,$(DEBUG_FLAGS) $(CXXFLAGS))\""
 RELEASE_DEFS   = -DCOMPILER_OPTIONS="\"$(filter-out -fdebug-prefix-map=%,$(RELEASE_FLAGS) $(CXXFLAGS))\""
 
-ifeq (0,$(shell $(CPP) -E -fsanitize=address,undefined btypes.h 2>&1 > /dev/null; echo $$?))
-	SANITIZER_FLAGS := -fsanitize=address,undefined
-endif
-ifndef SANITIZER_FLAGS
-	ifeq (0,$(shell $(CPP) -E -fsanitize=address btypes.h 2>&1 > /dev/null; echo $$?))
-		SANITIZER_FLAGS := -fsanitize=address
-	endif
-endif
-ifndef SANITIZER_FLAGS
-	ifeq (0,$(shell $(CPP) -E -fsanitize=undefined btypes.h 2>&1 > /dev/null; echo $$?))
-		SANITIZER_FLAGS := -fsanitize=undefined
-	endif
-endif
-
 BOWTIE2_BIN_LIST :=     bowtie2-build-s \
                         bowtie2-build-l \
                         bowtie2-align-s \
@@ -239,12 +225,6 @@
                         bowtie2-align-l-debug \
                         bowtie2-inspect-s-debug \
                         bowtie2-inspect-l-debug
-BOWTIE2_BIN_LIST_SAN := bowtie2-build-s-sanitized \
-                        bowtie2-build-l-sanitized \
-                        bowtie2-align-s-sanitized \
-                        bowtie2-align-l-sanitized \
-                        bowtie2-inspect-s-sanitized \
-                        bowtie2-inspect-l-sanitized
 
 GENERAL_LIST := $(wildcard scripts/*.sh) \
                 $(wildcard scripts/*.pl) \
@@ -301,10 +281,9 @@
 .PHONY: all allall both both-debug
 
 all: $(BOWTIE2_BIN_LIST) ;
-allall: $(BOWTIE2_BIN_LIST) $(BOWTIE2_BIN_LIST_DBG) $(BOWTIE2_BIN_LIST_SAN) ;
+allall: $(BOWTIE2_BIN_LIST) $(BOWTIE2_BIN_LIST_DBG) ;
 both: bowtie2-align-s bowtie2-build-s bowtie2-align-l bowtie2-build-l ;
 both-debug: bowtie2-align-s-debug bowtie2-build-s-debug bowtie2-align-l-debug bowtie2-build-l-debug ;
-both-sanitized: bowtie2-align-s-sanitized bowtie2-build-s-sanitized bowtie2-align-l-sanitized bowtie2-build-l-sanitized ;
 
 DEFS := -fno-strict-aliasing \
         -DBOWTIE2_VERSION="\"`cat VERSION`\"" \
@@ -318,14 +297,12 @@
         $(CPPFLAGS) \
         $(CFLAGS)
 
-# set compiler flags for all sanitized builds
-$(BOWTIE2_BIN_LIST_SAN): CXXFLAGS += $(SANITIZER_FLAGS)
 
 #
 # bowtie2-build targets
 #
 
-bowtie2-build-s-sanitized bowtie2-build-s: bt2_build.cpp $(SHARED_CPPS) $(HEADERS)
+bowtie2-build-s: bt2_build.cpp $(SHARED_CPPS) $(HEADERS)
 	$(CXX) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 $(NOASSERT_FLAGS) -Wall \
 		$(CPPFLAGS) \
@@ -333,7 +310,7 @@
 		$(SHARED_CPPS) $(BUILD_CPPS_MAIN) \
 		$(LDFLAGS) $(LDLIBS)
 
-bowtie2-build-l-sanitized bowtie2-build-l: bt2_build.cpp $(SHARED_CPPS) $(HEADERS)
+bowtie2-build-l: bt2_build.cpp $(SHARED_CPPS) $(HEADERS)
 	$(CXX) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 -DBOWTIE_64BIT_INDEX $(NOASSERT_FLAGS) -Wall \
 		$(CPPFLAGS) \
@@ -361,7 +338,7 @@
 # bowtie2-align targets
 #
 
-bowtie2-align-s-sanitized bowtie2-align-s: bt2_search.cpp $(SEARCH_CPPS) $(SHARED_CPPS) $(HEADERS) $(SEARCH_FRAGMENTS)
+bowtie2-align-s: bt2_search.cpp $(SEARCH_CPPS) $(SHARED_CPPS) $(HEADERS) $(SEARCH_FRAGMENTS)
 	$(CXX) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 $(NOASSERT_FLAGS) -Wall \
 		$(CPPFLAGS) \
@@ -369,7 +346,7 @@
 		$(SHARED_CPPS) $(SEARCH_CPPS_MAIN) \
 		$(LDFLAGS) $(LDLIBS)
 
-bowtie2-align-l-sanitized bowtie2-align-l: bt2_search.cpp $(SEARCH_CPPS) $(SHARED_CPPS) $(HEADERS) $(SEARCH_FRAGMENTS)
+bowtie2-align-l: bt2_search.cpp $(SEARCH_CPPS) $(SHARED_CPPS) $(HEADERS) $(SEARCH_FRAGMENTS)
 	$(CXX) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 -DBOWTIE_64BIT_INDEX $(NOASSERT_FLAGS) -Wall \
 		$(CPPFLAGS) \
@@ -399,7 +376,7 @@
 # bowtie2-inspect targets
 #
 
-bowtie2-inspect-s-sanitized bowtie2-inspect-s: bt2_inspect.cpp $(HEADERS) $(SHARED_CPPS)
+bowtie2-inspect-s: bt2_inspect.cpp $(HEADERS) $(SHARED_CPPS)
 	$(CXX) $(RELEASE_FLAGS) \
 		$(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 -DBOWTIE_INSPECT_MAIN -Wall \
@@ -408,7 +385,7 @@
 		$(SHARED_CPPS) \
 		$(LDFLAGS) $(LDLIBS)
 
-bowtie2-inspect-l-sanitized bowtie2-inspect-l: bt2_inspect.cpp $(HEADERS) $(SHARED_CPPS)
+bowtie2-inspect-l: bt2_inspect.cpp $(HEADERS) $(SHARED_CPPS)
 	$(CXX) $(RELEASE_FLAGS) \
 		$(RELEASE_DEFS) $(CXXFLAGS) \
 		$(DEFS) -DBOWTIE2 -DBOWTIE_INSPECT_MAIN  -DBOWTIE_64BIT_INDEX -Wall \
@@ -609,7 +586,7 @@
 
 .PHONY: clean
 clean:
-	rm -f $(BOWTIE2_BIN_LIST) $(BOWTIE2_BIN_LIST_DBG) $(BOWTIE2_BIN_LIST_SAN) \
+	rm -f $(BOWTIE2_BIN_LIST) $(BOWTIE2_BIN_LIST_DBG) \
 	$(addsuffix .exe,$(BOWTIE2_BIN_LIST) $(BOWTIE2_BIN_LIST_DBG)) \
 	bowtie2-*.zip
 	rm -f core.* .tmp.head
--- bowtie2.orig/bowtie2
+++ bowtie2/bowtie2
@@ -140,7 +140,6 @@
 }
 
 my $debug = 0;
-my $sanitized = 0;
 my %read_fns = ();
 my %read_compress = ();
 my $cap_out = undef;       # Filename for passthrough
@@ -199,10 +198,6 @@
 		$debug = 1;
 		$bt2_args[$i] = undef;
 	}
-	if(not $debug and $arg eq "--sanitized") {
-		$sanitized = 1;
-		$bt2_args[$i] = undef;
-	}
 	if($arg eq "--no-unal") {
 		$no_unal = 1;
 		$bt2_args[$i] = undef;
@@ -503,9 +498,6 @@
 if ($debug) {
     $suffix = "-debug";
 }
-elsif($sanitized) {
-    $suffix = "-sanitized";
-}
 
 # Construct command invoking bowtie2-align
 quote_params(\@bt2_args);
--- bowtie2.orig/bowtie2-build
+++ bowtie2/bowtie2-build
@@ -36,7 +36,6 @@
 
     group = parser.add_mutually_exclusive_group()
     group.add_argument('--debug', action='store_true')
-    group.add_argument('--sanitized', action='store_true')
 
     logging.basicConfig(level=logging.ERROR,
                         format='%(levelname)s: %(message)s'
@@ -64,10 +63,6 @@
         build_bin_spec += '-debug'
         build_bin_l += '-debug'
 
-    if script_options.sanitized:
-        build_bin_spec += '-sanitized'
-        build_bin_l += '-sanitized'
-
     if script_options.large_index:
         build_bin_spec = os.path.join(ex_path,build_bin_l)
     elif len(argv) >= 2:
--- bowtie2.orig/bowtie2-inspect
+++ bowtie2/bowtie2-inspect
@@ -34,7 +34,6 @@
 
     group = parser.add_mutually_exclusive_group()
     group.add_argument('--debug', action='store_true')
-    group.add_argument('--sanitized', action='store_true')
 
     parser.add_argument('--verbose', action='store_true')
     parser.add_argument('--large-index', action='store_true')
@@ -61,10 +60,6 @@
         inspect_bin_spec += '-debug'
         inspect_bin_l += '-debug'
 
-    if script_options.sanitized:
-        inpsect_bin_spec += '-sanitized'
-        inspect_bin_l += '-sanitized'
-
     if script_options.large_index:
         inspect_bin_spec = os.path.join(ex_path,inspect_bin_l)
     elif len(argv) >= 1:
--- bowtie2.orig/scripts/test/simple_tests.pl
+++ bowtie2/scripts/test/simple_tests.pl
@@ -4602,7 +4602,7 @@
 	close(FA);
 	if($do_build) {
 		my $build_args = "";
-		my $cmd = "$bowtie2_build $idx_type --quiet --sanity $build_args $fa .simple_tests.tmp";
+		my $cmd = "$bowtie2_build $idx_type --quiet $build_args $fa .simple_tests.tmp";
 		print "$cmd\n";
 		system($cmd);
 		($? == 0) || die "Bad exitlevel from bowtie2-build: $?";
@@ -4804,7 +4804,7 @@
 my $tmpfafn = ".simple_tests.pl.fa";
 my $last_ref = undef;
 foreach my $large_idx (undef,1) {
-	foreach my $binary_type ("release", "debug", "sanitized") {
+	foreach my $binary_type ("release", "debug") {
 		for (my $ci = 0; $ci < scalar(@cases); $ci++) {
 			my $c = $cases[$ci];
 			last unless defined($c);
--- bowtie2.orig/scripts/test/simple_tests.sh
+++ bowtie2/scripts/test/simple_tests.sh
@@ -21,21 +21,6 @@
 
 #  simple_tests.sh
 
-export ASAN_OPTIONS=halt_on_error=1
-export UBSAN_OPTIONS=halt_on_error=1
-
-#make $* bowtie2-align-s \
-#		bowtie2-align-l \
-#		bowtie2-align-s-debug \
-#		bowtie2-align-l-debug \
-#		bowtie2-align-s-sanitized \
-#		bowtie2-align-l-sanitized \
-#		bowtie2-build-s \
-#		bowtie2-build-l \
-#		bowtie2-build-s-debug \
-#		bowtie2-build-l-debug \
-#		bowtie2-build-s-sanitized \
-#		bowtie2-build-l-sanitized && \
 perl scripts/test/simple_tests.pl \
 	--bowtie2=./bowtie2 \
 	--bowtie2-build=./bowtie2-build \
