dentearl / mafTools

Bioinformatics tools for dealing with Multiple Alignment Format (MAF) files.
Other
104 stars 32 forks source link

Does Not Build #6

Closed adamnovak closed 10 years ago

adamnovak commented 10 years ago

Fails to build on GCC 4.9.0, producing this error:

cd mafExtractor && make all
make[1]: Entering directory `/cluster/home/anovak/build/mafTools/mafExtractor'
gcc -std=c99 -O3 -c -O3 -Wall -Werror --pedantic -funroll-loops -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -I ../../sonLib/lib -I ../inc -I ../external -I /hive/groups/recon/local/include src/mafExtractorAPI.c -o src/mafExtractorAPI.o.tmp -lm
src/mafExtractorAPI.c: In function ‘processBlockForSplice’:
src/mafExtractorAPI.c:193:23: error: variable ‘sum’ set but not used [-Werror=unused-but-set-variable]
     uint64_t len = 0, sum = 0;
                       ^
cc1: all warnings being treated as errors
make[1]: *** [src/mafExtractorAPI.o] Error 1
make[1]: Leaving directory `/cluster/home/anovak/build/mafTools/mafExtractor'
make: *** [mafExtractor.all] Error 2
dentearl commented 10 years ago

That's weird, sum is used two lines away on line 195:

https://github.com/dentearl/mafTools/blob/master/mafExtractor/src/mafExtractorAPI.c#L195

bool *targetColumns = NULL;                                             
uint64_t len = 0, sum = 0;                                              
mafBlock_t *head = NULL, *mb = NULL;                                    
sum = getTargetColumns(&targetColumns, &len, b, seq, start, stop);      
// printTargetColumns(targetColumns, len);                              
int64_t **offsets = createOffsets(maf_mafBlock_getNumberOfSequences(b));

Is there any chance that your line 195 has been changed?

joelarmstrong commented 10 years ago

The specific warning is -Wunused-but-set-variable, which is only turned on with -Wall starting in new versions of gcc. So a variable that is set as a return value but never actually used after that still generates an error with those versions.

I didn't actually look very closely, but if this is only used in an assert somewhere, it may still not count as being used if NDEBUG is set. I think Benedict adds a "(void) unused_var;" statement in those cases when they come up.

darked89 commented 9 years ago

Hello,

same error with gcc 4.8.2 on Centos 6 and 4.8.1 on Mint 16 (see below). I also have CLANG 3.2-7 but could not figure out acceptable changes to inc/common.mk.

Many thanks for your help,

Darek

src/mafExtractorAPI.c: In function ‘checkBlock’: src/mafExtractorAPI.c:423:17: error: variable ‘dummy’ set but not used [-Werror=unused-but-set-variable] mafBlock_t dummy = NULL; ^ cc1: all warnings being treated as errors make[1]: ** [src/mafExtractorAPI.o] Error 1 make[1]: Leaving directory `/nfs/users/myhome/MAFtools/mafTools/mafExtractor' make: *\ [mafExtractor.all] Error 2