Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Description: save resources by not making/testing the -fsantize variants
--- bowtie2.orig/Makefile
+++ bowtie2/Makefile
@@ -186,15 +186,6 @@
 SEARCH_FRAGMENTS := $(wildcard search_*_phase*.c)
 VERSION := $(shell cat BOWTIE2_VERSION)
 
-SANITIZER_FLAGS :=
-ifeq (0,$(shell $(CXX) -E -fsanitize=address,undefined btypes.h > /dev/null 2>&1; echo $$?))
-  SANITIZER_FLAGS := -fsanitize=address,undefined
-else ifeq (0,$(shell $(CXX) -E -fsanitize=address btypes.h > /dev/null 2>&1; echo $$?))
-  SANITIZER_FLAGS := -fsanitize=address
-else ifeq (0,$(shell $(CXX) -E -fsanitize=undefined btypes.h > /dev/null 2>&1; echo $$?))
-  SANITIZER_FLAGS := -fsanitize=undefined
-endif
-
 DEBUG_FLAGS    := -O0 -g3 $(SSE_FLAG)
 RELEASE_FLAGS  := -O3 $(SSE_FLAG) -funroll-loops -g3
 NOASSERT_FLAGS := -DNDEBUG
@@ -214,15 +205,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
-ifndef SANITIZER_FLAGS
-        BOWTIE2_BIN_LIST_SAN =
-endif
 
 GENERAL_LIST := $(wildcard scripts/*.sh) \
   $(wildcard scripts/*.pl) \
@@ -274,10 +256,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 BOWTIE2_VERSION`\"" \
@@ -291,18 +272,11 @@
   $(CPPFLAGS) \
   $(CFLAGS)
 
-# set compiler flags for all sanitized builds
-ifdef BOWTIE2_BIN_LIST_SAN
-$(BOWTIE2_BIN_LIST_SAN): CXXFLAGS+=$(SANITIZER_FLAGS)
-else
-$(BOWTIE2_BIN_LIST_SAN): $(error "Compiler does not support...")
-endif
-
 #
 # 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) \
@@ -310,7 +284,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) \
@@ -338,7 +312,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) \
@@ -346,7 +320,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) \
@@ -376,7 +350,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 \
@@ -385,7 +359,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 \
@@ -586,7 +560,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
@@ -122,7 +122,6 @@
 sub isWrapped($) { return defined($wrapped{$_[0]}); }
 
 my $debug = 0;
-my $sanitized = 0;
 my %read_fns = ();
 my %read_compress = ();
 my $cap_out = undef;       # Filename for passthrough
@@ -184,7 +183,6 @@
         "keep"                          => \$keep,
         "verbose"                       => \$verbose,
         "debug"                         => \$debug,
-        "sanitized"                     => \$sanitized,
         "large-index"                   => \$large_idx,
         "no-unal"                       => \$no_unal,
         "un=s"                          => \&handle_un_or_al,
@@ -473,9 +471,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
@@ -33,7 +33,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')
@@ -60,10 +59,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
@@ -4605,7 +4605,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: $?";
@@ -4807,7 +4807,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/bt2_build.cpp
+++ bowtie2/bt2_build.cpp
@@ -147,7 +147,6 @@
 	out << "    --large-index           force generated index to be 'large', even if ref" << endl
 		<< "                            has fewer than 4 billion nucleotides" << endl
 		<< "    --debug                 use the debug binary; slower, assertions enabled" << endl
-		<< "    --sanitized             use sanitized binary; slower, uses ASan and/or UBSan" << endl
 		<< "    --verbose               log the issued command" << endl;
 	}
 	out << "    -a/--noauto             disable automatic -p/--bmax/--dcv memory-fitting" << endl
--- bowtie2.orig/bt2_inspect.cpp
+++ bowtie2/bt2_inspect.cpp
@@ -78,7 +78,6 @@
 		out << "  --large-index      force inspection of the 'large' index, even if a" << endl
 			<< "                     'small' one is present." << endl
 			<< "  --debug            use the debug binary; slower, assertions enabled" << endl
-			<< "  --sanitized        use sanitized binary; slower, uses ASan and/or UBSan" << endl
 			<< "  --verbose          log the issued command" << endl;
 	}
 	out << "  -a/--across <int>  Number of characters across in FASTA output (default: 60)" << endl
--- bowtie2.orig/scripts/test/simple_tests.sh
+++ bowtie2/scripts/test/simple_tests.sh
@@ -21,8 +21,8 @@
 
 #  simple_tests.sh
 
-export ASAN_OPTIONS=halt_on_error=1
-export UBSAN_OPTIONS=halt_on_error=1
+#export ASAN_OPTIONS=halt_on_error=1
+#export UBSAN_OPTIONS=halt_on_error=1
 
 #MAKE=`which gmake || which make`
 #$MAKE $* bowtie2-align-s \
