Skip to content

Commit

Permalink
Merge pull request #1032 from genometools/clang-build-fixes
Browse files Browse the repository at this point in the history
Clang build fixes
  • Loading branch information
satta committed Oct 7, 2023
2 parents 464b8c7 + bac129e commit 8cecf09
Show file tree
Hide file tree
Showing 25 changed files with 75 additions and 62 deletions.
2 changes: 1 addition & 1 deletion gtruby/core/alphabet.rb
Expand Up @@ -74,7 +74,7 @@ def self.create_from_sequence(files)
sa = StrArray.new
files.each do |f|
fn = f.to_s
if (!File.exists?(fn))
if (!File.exist?(fn))
GT.gterror("file not found: #{fn}")
end
sa.add(fn)
Expand Down
2 changes: 1 addition & 1 deletion gtruby/core/encseq.rb
Expand Up @@ -211,7 +211,7 @@ def encode(files, indexname)
sa = StrArray.new
files.each do |f|
fn = f.to_s
if (!File.exists?(fn))
if (!File.exist?(fn))
GT.gterror("file not found: #{fn}")
end
sa.add(fn)
Expand Down
4 changes: 2 additions & 2 deletions scripts/add_revcmp.rb
Expand Up @@ -10,7 +10,7 @@ def initialize()
end

def read_sequence(file)
if !File.exists?(file)
if !File.exist?(file)
raise "The specified file #{file} does not exist."
end
File.open(file) do |line|
Expand Down Expand Up @@ -42,7 +42,7 @@ class MSA
attr_reader :seqs, :length, :cons

def initialize(file)
if !File.exists?(file)
if !File.exist?(file)
raise "The specified file #{file} does not exist."
end
@file = file
Expand Down
2 changes: 1 addition & 1 deletion scripts/appendsuffix.rb
Expand Up @@ -27,7 +27,7 @@
end_usage

if ARGV.size < 2 || !File.exists?(ARGV[0])
if ARGV.size < 2 || !File.exist?(ARGV[0])
puts usage
exit
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmp-seex-iter.rb
Expand Up @@ -42,7 +42,7 @@
end

test_files.each do |filename|
if not File.exists?(filename)
if not File.exist?(filename)
STDERR.puts "#{filename} does not exist"
exit 1
else
Expand Down
4 changes: 2 additions & 2 deletions scripts/codegen
Expand Up @@ -113,7 +113,7 @@ end
def prepare_tool_c(path, basename)
tools_dir = File.join(find_src_directory, "tools")
gt_template_c = File.expand_path(File.join(tools_dir, "gt_template.c"))
CodeGen.perror("File #{gt_template_c} not found") if !File.exists?(gt_template_c)
CodeGen.perror("File #{gt_template_c} not found") if !File.exist?(gt_template_c)
# skip license template:
c_template = IO.read(gt_template_c)
c_template =~ /(.*?)(#include.*)/m
Expand All @@ -127,7 +127,7 @@ end
def prepare_tool_h(path, basename)
tools_dir = File.join(find_src_directory, "tools")
gt_template_h = File.expand_path(File.join(tools_dir, "gt_template.h"))
CodeGen.perror("File #{gt_template_h} not found") if !File.exists?(gt_template_h)
CodeGen.perror("File #{gt_template_h} not found") if !File.exist?(gt_template_h)
h_template = IO.read(gt_template_h)
# skip license template:
h_template =~ /(.*?)(#ifndef.*)/m
Expand Down
4 changes: 2 additions & 2 deletions scripts/dwmake.rb
Expand Up @@ -141,7 +141,7 @@ def makecompilerflags(fp,options)
fp.puts
end

if File.exists?('LocalMakefile')
if File.exist?('LocalMakefile')
FileUtils.mv('LocalMakefile','LocalMakefile.previous')
end

Expand All @@ -151,7 +151,7 @@ def makecompilerflags(fp,options)
makecompilerflags(fp,options)
end

if File.exists?('LocalMakefile.previous') and
if File.exist?('LocalMakefile.previous') and
not FileUtils.compare_file('LocalMakefile','LocalMakefile.previous') and
options.check
STDERR.puts "Current and previous LocalMakefile files differ: first " +
Expand Down
2 changes: 1 addition & 1 deletion scripts/rdj-checkcontigs.rb
Expand Up @@ -34,7 +34,7 @@
def get_template_index(templatefilename)
indexname = "#{templatefilename}.vmatch"
# the index is constructed only if necessary
unless File.exists?("#{indexname}.suf")
unless File.exist?("#{indexname}.suf")
puts "# index #{indexname} not found, running mkvtree..."
cmd = "mkvtree -dna -pl -allout -db #{templatefilename} "+
"-indexname #{indexname}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/rdj-parsetranscript.rb
Expand Up @@ -2523,7 +2523,7 @@ def parse_series(args)
next
end
if !logtype
if (!File.exists?(a))
if (!File.exist?(a))
g = Dir.glob("#{a}*")
if (g.size == 1)
a = g[0]
Expand Down
8 changes: 4 additions & 4 deletions scripts/sensitivity-test.rb
Expand Up @@ -220,7 +220,7 @@ def callseedextend(mincoverage,indexname,inputfile,destfile,minidentity,length,
matchlist = find_matchesinfile("#{destfile}.txt")
["esq","ssp"].each do |suffix|
filename = "#{indexname}.#{suffix}"
if File.exists?(filename)
if File.exist?(filename)
File.delete(filename)
end
end
Expand All @@ -231,7 +231,7 @@ def callseedextend(mincoverage,indexname,inputfile,destfile,minidentity,length,
def runseedextend(mincoverage,inputdir,targetdir,weakends,withalignment,
seedlength,minidentity,length,seqnum,bias)
inputfile = makefilename(inputdir,minidentity,"rand",length,seqnum)
if not File.exists?(inputfile + ".fas")
if not File.exist?(inputfile + ".fas")
inputfile = makefilename(inputdir,minidentity,"rand-mult",length,seqnum)
end
destfile = makefilename(targetdir,minidentity,"gtout",length,seqnum)
Expand All @@ -244,7 +244,7 @@ def runseedextend(mincoverage,inputdir,targetdir,weakends,withalignment,
def rundaligner(mincoverage,inputdir,targetdir,seedlength,minidentity,length,
seqnum,tofile = true)
inputfile = makefilename(inputdir,minidentity,"rand",length,seqnum)
if not File.exists?(inputfile + ".fas")
if not File.exist?(inputfile + ".fas")
inputfile = makefilename(inputdir,minidentity,"rand-mult",length,seqnum)
end
destfile = makefilename(targetdir,minidentity,"daout",length,seqnum)
Expand Down Expand Up @@ -294,7 +294,7 @@ def rerun_seedextend(options,seedlength)
inputfiledir = options.inputdir
puts # "minid=#{minidentity}, length=#{minidentity}, seqnum=#{seqnum}"
inputfile = makefilename(inputfiledir,minidentity,"rand",length,seqnum)
if not File.exists?(inputfile + ".fas")
if not File.exist?(inputfile + ".fas")
inputfile = makefilename(inputfiledir,minidentity,"rand-mult",length,seqnum)
end
puts "# inputfile=#{inputfile}.fas"
Expand Down
4 changes: 2 additions & 2 deletions scripts/skmake.rb
Expand Up @@ -109,7 +109,7 @@ def makecompilerflags(fp,options)
end
end

if File.exists?('LocalMakefile')
if File.exist?('LocalMakefile')
FileUtils.mv('LocalMakefile','LocalMakefile.previous')
end

Expand All @@ -119,7 +119,7 @@ def makecompilerflags(fp,options)
makecompilerflags(fp,options)
end

if File.exists?('LocalMakefile.previous') and
if File.exist?('LocalMakefile.previous') and
not FileUtils.compare_file('LocalMakefile','LocalMakefile.previous')
STDERR.puts "LocalMakefile and LocalMakefile.previous files differ: first " +
"remove these"
Expand Down
2 changes: 1 addition & 1 deletion scripts/sktest.sh
Expand Up @@ -65,6 +65,6 @@ env -i GT_MEM_BOOKKEEPING=on ${program} -keywords 'gt_packedindex' \

cd ..

sktest-match.sh
scripts/sktest-match.sh
echo "start at ${startdate}"
echo "end at `date`"
1 change: 0 additions & 1 deletion src/annotationsketch/custom_track_script_wrapper.h
Expand Up @@ -22,6 +22,5 @@
#include "annotationsketch/custom_track.h"

const GtCustomTrackClass* gt_custom_track_script_wrapper_class(void);
GtCustomTrack* gt_custom_track_script_wrapper_new();

#endif
4 changes: 2 additions & 2 deletions src/core/csvline_reader.c
Expand Up @@ -242,6 +242,7 @@ void gt_csvline_reader_dist_only_for_column(GtCsvlineReader *csvline_reader,
csvline_reader->dist.alphabet.nextfreechar = write_idx;
}

#ifndef NDEBUG
void gt_csvline_reader_dist_check(const GtCsvlineReader *csvline_reader,
const char *string,GtUword len)
{
Expand All @@ -259,15 +260,14 @@ void gt_csvline_reader_dist_check(const GtCsvlineReader *csvline_reader,
numchars++;
}
}
#ifndef NDEBUG
gt_assert(numchars == csvline_reader->dist.alphabet.nextfreechar);
for (idx = 0; idx < numchars; idx++)
{
char cc = csvline_reader->dist.alphabet.spacechar[idx];
gt_assert(csvline_reader->dist.charcount[(int) cc] > 0);
}
#endif
}
#endif

void gt_csvline_reader_dist_show(const GtCsvlineReader *csvline_reader)
{
Expand Down
12 changes: 9 additions & 3 deletions src/match/sfx-diffcov.c
Expand Up @@ -1311,7 +1311,7 @@ static void dc_differencecover_sortsample(GtDifferencecover *dcov,
GtTimer *sfxprogress,
bool withcheck)
{
GtUword pos, sampleindex, posinserted, fullspecials = 0, specials = 0;
GtUword pos, sampleindex, fullspecials = 0, specials = 0;
unsigned int modvalue, unitsnotspecial;
Diffvalue *diffptr, *afterend;
GtCodetype code;
Expand Down Expand Up @@ -1419,8 +1419,12 @@ static void dc_differencecover_sortsample(GtDifferencecover *dcov,
{
gt_assert(dcov->sortedsample == NULL);
}
posinserted = dc_derivespecialcodesonthefly(dcov,
withcheck ? &codelist : NULL);
#ifndef NDEBUG
GtUword posinserted =
#else
(void)
#endif
dc_derivespecialcodesonthefly(dcov,withcheck ? &codelist : NULL);
GT_FREEARRAY(&codelist,Codeatposition);
diffptr = dcov->diffvalues;
afterend = dcov->diffvalues + dcov->size;
Expand All @@ -1444,7 +1448,9 @@ static void dc_differencecover_sortsample(GtDifferencecover *dcov,
code);
gt_assert(sampleindex < dcov->effectivesamplesize);
dc_suffixptrset(dcov,sampleindex,pos);
#ifndef NDEBUG
posinserted++;
#endif
}
diffptr++;
}
Expand Down
10 changes: 9 additions & 1 deletion src/tools/gt_sfxmap.c
Expand Up @@ -909,10 +909,12 @@ static int gt_sfxmap_compressedesa(const char *indexname,GtError *err)
unsigned int bits2add = (unsigned int) bitsperentry,
remainingbits = 0;
GtUword bitbuffer = 0,
countentries = 0,
*suftabptr,
*suftab = gt_malloc(sizeof *suftab *
(size_t) numberofentries);
#ifndef NDEBUG
GtUword countentries = 0;
#endif

suftabptr = suftab;
while (true)
Expand Down Expand Up @@ -940,7 +942,9 @@ static int gt_sfxmap_compressedesa(const char *indexname,GtError *err)
*suftabptr++ = bitbuffer;
bitbuffer = 0;
bits2add = (unsigned int) bitsperentry;
#ifndef NDEBUG
countentries++;
#endif
} else
{
gt_assert(remainingbits < 64U);
Expand Down Expand Up @@ -989,7 +993,9 @@ static int gt_sfxmap_compresslcp(const char *indexname,
}
if (!haserr)
{
#ifndef NDEBUG
GtUword elems = 0;
#endif
GT_UNUSED GtUword totallength
= gt_Sequentialsuffixarrayreader_totallength(ssar);
GtUword maxbranchdepth
Expand Down Expand Up @@ -1018,7 +1024,9 @@ static int gt_sfxmap_compresslcp(const char *indexname,

SSAR_NEXTSEQUENTIALLCPTABVALUE(currentlcp,ssar);
gt_bitbuffer_write_fixed_bits_FILE (bitbuffer,currentlcp);
#ifndef NDEBUG
elems++;
#endif
}
}
if (!haserr)
Expand Down
2 changes: 1 addition & 1 deletion testdata/gtruby/encseq.rb
Expand Up @@ -70,7 +70,7 @@ def delete_idx(indexname)

val = create_es("foo")
@idxsuffixes.each do |suf|
raise if !File.exists?("foo.#{suf}")
raise if !File.exist?("foo.#{suf}")
end
delete_idx("foo")

Expand Down
4 changes: 2 additions & 2 deletions testsuite/gt_encseq2spm_include.rb
Expand Up @@ -39,7 +39,7 @@ def run_encseq2spm(readset)
# compare results with precalculated known results
[700, 7000].each do |nofreads|
readset="#{$gttestdata}/readjoiner/#{nofreads}x_100nt_reads"
if File.exists?(readset)
if File.exist?(readset)
Name "gt encseq2spm: #{nofreads}x100"
Keywords "gt_encseq2spm"
Test do
Expand All @@ -49,7 +49,7 @@ def run_encseq2spm(readset)

[161, 200, 300, 400, 600, 1000].each do |len|
reads = "#{$gttestdata}/readjoiner/#{nofreads}x_#{len}nt_reads"
if File.exists?(reads)
if File.exist?(reads)
Name "gt encseq2spm: #{nofreads}x#{len}"
Keywords "gt_encseq2spm"
Test do
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gt_encseq_include.rb
Expand Up @@ -246,7 +246,7 @@ def testformirrored(s, readmode)
Keywords "gt_encseq formats"
Test do
fasta = formatfile.gsub(/\.[a-z]+$/, ".fna")
if File.exists?("#{$testdata}#{fasta}") then
if File.exist?("#{$testdata}#{fasta}") then
run "cp #{$testdata}#{formatfile} infile"
run_test "#{$bin}gt encseq encode -v -indexname sfx infile"
run_test "#{$bin}gt encseq decode -output concat sfx > sfx.seq"
Expand Down
16 changes: 8 additions & 8 deletions testsuite/gt_ltrdigest_include.rb
Expand Up @@ -430,7 +430,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"-hmms #{$gttestdata}ltrdigest/hmms/RVT_1.hmm -- " + \
"#{$gttestdata}ltrdigest/dmel_md5_4.gff3 ",
:retval => 0, :maxtime => 12000
if File.exists?("result4_pdom_RVT_1.ali") then
if File.exist?("result4_pdom_RVT_1.ali") then
raise TestFailed, "file \"result4_pdom_RVT_1.ali\" should not exist"
end
run_test "#{$bin}gt -j 2 ltrdigest -outfileprefix result4 " + \
Expand All @@ -439,7 +439,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"-aliout yes " + \
"#{$gttestdata}ltrdigest/dmel_md5_4.gff3 ",
:retval => 0, :maxtime => 12000
if !File.exists?("result4_pdom_RVT_1.ali") then
if !File.exist?("result4_pdom_RVT_1.ali") then
raise TestFailed, "file \"result4_pdom_RVT_1.ali\" does not exist"
end
end
Expand All @@ -455,7 +455,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"-hmms #{$gttestdata}ltrdigest/hmms/RVT_1.hmm -- " + \
"#{$gttestdata}ltrdigest/dmel_md5_4.gff3 ",
:retval => 0, :maxtime => 12000
if File.exists?("result4_pdom_RVT_1_aa.fas") then
if File.exist?("result4_pdom_RVT_1_aa.fas") then
raise TestFailed, "file \"result4_pdom_RVT_1_aa.fas\" should not exist"
end
run_test "#{$bin}gt -j 2 ltrdigest -outfileprefix result4 " + \
Expand All @@ -464,7 +464,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"-aaout yes " + \
"#{$gttestdata}ltrdigest/dmel_md5_4.gff3 ",
:retval => 0, :maxtime => 12000
if !File.exists?("result4_pdom_RVT_1_aa.fas") then
if !File.exist?("result4_pdom_RVT_1_aa.fas") then
raise TestFailed, "file \"result4_pdom_RVT_1_aa.fas\" does not exist"
end
if !(`grep ">" result4_pdom_RVT_1_aa.fas | wc -l`.to_i > 1) then
Expand Down Expand Up @@ -693,7 +693,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"#{$gttestdata}ltrdigest/dmel_test_Run9_4.gff3.sorted " + \
"4_genomic_dmel_RELEASE3-1.FASTA.gz", \
:retval => 0, :maxtime => 12000
if File.exists?("result4_pdom_RVT_1.ali") then
if File.exist?("result4_pdom_RVT_1.ali") then
raise TestFailed, "file \"result4_pdom_RVT_1.ali\" should not exist"
end
run_test "#{$bin}gt -j 2 ltrdigest -outfileprefix result4 " + \
Expand All @@ -702,7 +702,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"#{$gttestdata}ltrdigest/dmel_test_Run9_4.gff3.sorted " + \
"4_genomic_dmel_RELEASE3-1.FASTA.gz", \
:retval => 0, :maxtime => 12000
if !File.exists?("result4_pdom_RVT_1.ali") then
if !File.exist?("result4_pdom_RVT_1.ali") then
raise TestFailed, "file \"result4_pdom_RVT_1.ali\" does not exist"
end
end
Expand All @@ -718,7 +718,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"#{$gttestdata}ltrdigest/dmel_test_Run9_4.gff3.sorted " + \
"4_genomic_dmel_RELEASE3-1.FASTA.gz", \
:retval => 0, :maxtime => 12000
if File.exists?("result4_pdom_RVT_1_aa.fas") then
if File.exist?("result4_pdom_RVT_1_aa.fas") then
raise TestFailed, "file \"result4_pdom_RVT_1_aa.fas\" should not exist"
end
run_test "#{$bin}gt -j 2 ltrdigest -outfileprefix result4 " + \
Expand All @@ -727,7 +727,7 @@ def check_amino_acid_output(gff3file, chr, pdoms)
"#{$gttestdata}ltrdigest/dmel_test_Run9_4.gff3.sorted " + \
"4_genomic_dmel_RELEASE3-1.FASTA.gz", \
:retval => 0, :maxtime => 12000
if !File.exists?("result4_pdom_RVT_1_aa.fas") then
if !File.exist?("result4_pdom_RVT_1_aa.fas") then
raise TestFailed, "file \"result4_pdom_RVT_1_aa.fas\" does not exist"
end
end
Expand Down

0 comments on commit 8cecf09

Please sign in to comment.