Fixed gcc warnings

This commit is contained in:
Celine Mercier
2019-09-25 11:38:00 +02:00
parent c3b9e46291
commit 44517db51f
11 changed files with 49 additions and 69 deletions

View File

@ -84,7 +84,7 @@ cdef extern from "obiview.h" nogil:
Obiview_p obi_open_view(OBIDMS_p dms, const_char_p view_name) Obiview_p obi_open_view(OBIDMS_p dms, const_char_p view_name)
int obi_view_add_column(Obiview_p view, int obi_view_add_column(Obiview_p view,
const_char_p column_name, char* column_name,
obiversion_t version_number, obiversion_t version_number,
const_char_p alias, const_char_p alias,
OBIType_t data_type, OBIType_t data_type,

View File

@ -100,7 +100,7 @@ REQUIRES = ['Cython>=0.24',
'breathe>=4.0.0' 'breathe>=4.0.0'
] ]
os.environ['CFLAGS'] = '-O3 -Wall -I "src" -I "src/libecoPCR" -I "src/libjson"' os.environ['CFLAGS'] = '-O3 -w -I "src" -I "src/libecoPCR" -I "src/libjson"'
from Cython.Build import cythonize from Cython.Build import cythonize
@ -119,9 +119,7 @@ cython_ext = [Extension('.'.join([os.path.dirname(x).replace("python/",""),
libraries=["cobitools3"], libraries=["cobitools3"],
runtime_library_dirs=[get_python_lib()], runtime_library_dirs=[get_python_lib()],
extra_compile_args=['-msse2', extra_compile_args=['-msse2',
'-Wno-unused-function', '-w',
'-Wmissing-braces',
'-Wchar-subscripts',
'-fPIC' '-fPIC'
], ],
extra_link_args=["-Wl,-rpath,"+get_python_lib(), extra_link_args=["-Wl,-rpath,"+get_python_lib(),

View File

@ -479,7 +479,7 @@ int nparam_CountGCContent(char * seq ) {
return count; return count;
} }
void nparam_CleanSeq (char* inseq, char* outseq, int len) void nparam_CleanSeq (const char* inseq, char* outseq, int len)
{ {
int seqlen = strlen (inseq); int seqlen = strlen (inseq);
int i, j; int i, j;
@ -525,10 +525,10 @@ double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len)
//double thedS = nparam_GetInitialEntropy(nparm); //double thedS = nparam_GetInitialEntropy(nparm);
double thedS = -5.9f+nparm->rlogc; double thedS = -5.9f+nparm->rlogc;
double mtemp; double mtemp;
char c1; unsigned char c1;
char c2; unsigned char c2;
char c3; unsigned char c3;
char c4; unsigned char c4;
unsigned int i; unsigned int i;
char nseq[50]; char nseq[50];
char *useq = seq; char *useq = seq;
@ -556,7 +556,7 @@ double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len)
return mtemp; return mtemp;
} }
double nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len) double nparam_CalcTwoTM(PNNParams nparm, const char* seq1, const char* seq2, int len)
{ {
const unsigned long long minus1 = 0xFFFFFFFFFFFFFFFFLLU; const unsigned long long minus1 = 0xFFFFFFFFFFFFFFFFLLU;
const double NaN = *((double*)&minus1); const double NaN = *((double*)&minus1);
@ -564,10 +564,10 @@ double nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len)
//double thedS = nparam_GetInitialEntropy(nparm); //double thedS = nparam_GetInitialEntropy(nparm);
double thedS = -5.9f+nparm->rlogc; double thedS = -5.9f+nparm->rlogc;
double mtemp; double mtemp;
char c1; unsigned char c1;
char c2; unsigned char c2;
char c3; unsigned char c3;
char c4; unsigned char c4;
unsigned int i; unsigned int i;
char nseq1[50]; char nseq1[50];
char nseq2[50]; char nseq2[50];

View File

@ -53,7 +53,7 @@ double nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1);
double nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1); double nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1);
double nparam_CalcTM(double entropy,double enthalpy); double nparam_CalcTM(double entropy,double enthalpy);
double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len); double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len);
double nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len); double nparam_CalcTwoTM(PNNParams nparm, const char* seq1, const char* seq2, int len);
double nparam_GetInitialEntropy(PNNParams nparm) ; double nparam_GetInitialEntropy(PNNParams nparm) ;
double calculateMeltingTemperatureBasic (char * seq); double calculateMeltingTemperatureBasic (char * seq);

View File

@ -357,7 +357,7 @@ static int print_seq(Obiview_p i_view, Obiview_p o_view,
char* amplicon = NULL; char* amplicon = NULL;
double tm1,tm2; double tm1,tm2;
double tm=0; //double tm=0;
int32_t i; int32_t i;
@ -424,8 +424,8 @@ static int print_seq(Obiview_p i_view, Obiview_p o_view,
amplicon[amplicon_len] = 0; amplicon[amplicon_len] = 0;
} }
tm1=nparam_CalcTwoTM(tparm,oligo1,primer1,o1->patlen) - 273.15; tm1=nparam_CalcTwoTM(tparm, oligo1, primer1, o1->patlen) - 273.15;
tm2=nparam_CalcTwoTM(tparm,oligo2,primer2,o2->patlen) - 273.15; tm2=nparam_CalcTwoTM(tparm, oligo2, primer2, o2->patlen) - 273.15;
//tm = (tm1 < tm2) ? tm1:tm2; //tm = (tm1 < tm2) ? tm1:tm2;
if (isnan(tm1)) if (isnan(tm1))
@ -674,32 +674,28 @@ int obi_ecopcr(const char* i_dms_name,
PatternPtr o1c; PatternPtr o1c;
PatternPtr o2c; PatternPtr o2c;
double tm,tm1,tm2; OBIDMS_p i_dms = NULL;
OBIDMS_p o_dms = NULL;
OBIDMS_p i_dms; OBIDMS_taxonomy_p taxonomy = NULL;
OBIDMS_p o_dms;
OBIDMS_taxonomy_p taxonomy;
Obiview_p i_view = NULL; Obiview_p i_view = NULL;
Obiview_p o_view = NULL; Obiview_p o_view = NULL;
OBIDMS_column_p i_seq_column, i_taxid_column, \ OBIDMS_column_p i_seq_column = NULL, i_taxid_column = NULL, \
i_id_column, o_id_column, \ i_id_column = NULL, o_id_column = NULL, \
o_ori_seq_len_column, o_amplicon_column, o_amplicon_length_column, \ o_ori_seq_len_column = NULL, o_amplicon_column = NULL, o_amplicon_length_column = NULL, \
o_taxid_column, o_rank_column, o_name_column, \ o_taxid_column = NULL, o_rank_column = NULL, o_name_column = NULL, \
o_species_taxid_column, o_species_name_column, \ o_species_taxid_column = NULL, o_species_name_column = NULL, \
o_genus_taxid_column, o_genus_name_column, \ o_genus_taxid_column = NULL, o_genus_name_column = NULL, \
o_family_taxid_column, o_family_name_column, \ o_family_taxid_column = NULL, o_family_name_column = NULL, \
o_kingdom_taxid_column, o_kingdom_name_column, \ o_kingdom_taxid_column = NULL, o_kingdom_name_column = NULL, \
o_superkingdom_taxid_column, o_superkingdom_name_column, \ o_superkingdom_taxid_column = NULL, o_superkingdom_name_column = NULL, \
o_strand_column, \ o_strand_column = NULL, \
o_primer1_column, o_primer2_column, \ o_primer1_column = NULL, o_primer2_column = NULL, \
o_error1_column, o_error2_column, \ o_error1_column = NULL, o_error2_column = NULL, \
o_temp1_column, o_temp2_column = NULL; o_temp1_column = NULL, o_temp2_column = NULL;
index_t seq_count; index_t seq_count;
index_t checkedSequence = 0; index_t checkedSequence = 0;
index_t positiveSequence = 0;
index_t ampliconCount = 0;
obiint_t taxid; obiint_t taxid;
char* sequence; char* sequence;
@ -747,10 +743,6 @@ int obi_ecopcr(const char* i_dms_name,
o1c = complementPattern(o1); o1c = complementPattern(o1);
o2c = complementPattern(o2); o2c = complementPattern(o2);
tm1 = nparam_CalcSelfTM(&tparm,o1->cpat,o1->patlen) - 273.15;
tm2 = nparam_CalcSelfTM(&tparm,o2->cpat,o2->patlen) - 273.15;
tm = (tm1 < tm2) ? tm1:tm2;
// Open input DMS // Open input DMS
i_dms = obi_open_dms(i_dms_name, false); i_dms = obi_open_dms(i_dms_name, false);
if (i_dms == NULL) if (i_dms == NULL)
@ -976,8 +968,6 @@ int obi_ecopcr(const char* i_dms_name,
} }
checkedSequence = 0; checkedSequence = 0;
positiveSequence= 0;
ampliconCount = 0;
seq_count = (i_view->infos)->line_count; seq_count = (i_view->infos)->line_count;

View File

@ -401,7 +401,8 @@ int obi_lcs_align_one_column(const char* dms_name,
index_t seq_count; index_t seq_count;
index_t id1_idx, id2_idx; index_t id1_idx, id2_idx;
index_t seq1_idx, seq2_idx; index_t seq1_idx, seq2_idx;
int count1, count2; int count1 = 0;
int count2 = 0;
double score; double score;
int lcs_length; int lcs_length;
int ali_length; int ali_length;
@ -697,7 +698,8 @@ int obi_lcs_align_two_columns(const char* dms_name,
index_t seq2_count; index_t seq2_count;
index_t id1_idx, id2_idx; index_t id1_idx, id2_idx;
index_t seq1_idx, seq2_idx; index_t seq1_idx, seq2_idx;
int count1, count2; int count1 = 0;
int count2 = 0;
double score; double score;
int lcs_length; int lcs_length;
int ali_length; int ali_length;

View File

@ -828,7 +828,7 @@ OBIDMS_p obi_open_dms(const char* dms_path, bool cleaning)
OBIDMS_p dms; OBIDMS_p dms;
char* relative_dms_path; char* relative_dms_path;
char* absolute_dms_path; char* absolute_dms_path;
int clean_dms; //int clean_dms;
dms = NULL; dms = NULL;

View File

@ -3254,12 +3254,16 @@ int obi_write_taxonomy(OBIDMS_p dms, OBIDMS_taxonomy_p tax, const char* tax_name
return -1; return -1;
// Check if there are local taxa (if so last taxon is local) // Check if there are local taxa (if so last taxon is local)
if ((tax->taxa)->local_count > 0) if ((tax->taxa)->local_count > 0)
{
if (write_local_taxonomy_idx(dms, tax, tax_name) < 0) if (write_local_taxonomy_idx(dms, tax, tax_name) < 0)
return -1; return -1;
}
// Write preferred names if there are some // Write preferred names if there are some
if (tax->preferred_names != NULL) if (tax->preferred_names != NULL)
{
if (write_preferred_names_idx(dms, tax, tax_name) < 0) if (write_preferred_names_idx(dms, tax, tax_name) < 0)
return -1; return -1;
}
return 0; return 0;
} }

View File

@ -1045,7 +1045,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
index_t minimum_line_count; index_t minimum_line_count;
OBIType_t returned_data_type; OBIType_t returned_data_type;
OBIType_t stored_data_type; OBIType_t stored_data_type;
char* final_indexer_name; char* final_indexer_name = NULL;
char* built_elements_names = NULL; char* built_elements_names = NULL;
int64_t elts_names_length; int64_t elts_names_length;
char* column_directory_name; char* column_directory_name;
@ -2443,25 +2443,16 @@ int obi_dms_has_unfinished_columns(OBIDMS_p dms)
struct dirent* col_dirent; struct dirent* col_dirent;
DIR* col_dir; DIR* col_dir;
size_t i,j; size_t i,j;
char* column_file_path;
char* column_dir_path; char* column_dir_path;
char* col_name; char* col_name;
char* col_version_str; char* col_version_str;
// char* version_file;
obiversion_t col_version; obiversion_t col_version;
OBIDMS_column_header_p col_header; OBIDMS_column_header_p col_header;
// int n;
char* col_to_delete[1000];
char* dir_to_delete[1000];
int ddir;
int dcol;
int d;
int ret_value; int ret_value;
ret_value = 0; ret_value = 0;
// Find column directories // Find column directories
ddir = 0;
rewinddir(dms->directory); rewinddir(dms->directory);
while ((dms_dirent = readdir(dms->directory)) != NULL) while ((dms_dirent = readdir(dms->directory)) != NULL)
{ {
@ -2497,7 +2488,6 @@ int obi_dms_has_unfinished_columns(OBIDMS_p dms)
} }
// Iteration on files of this column directory // Iteration on files of this column directory
dcol = 0;
while ((col_dirent = readdir(col_dir)) != NULL) while ((col_dirent = readdir(col_dir)) != NULL)
{ {
if ((col_dirent->d_name)[0] == '.') if ((col_dirent->d_name)[0] == '.')

View File

@ -17,7 +17,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <inttypes.h> #include <inttypes.h>
#include <math.h> #include <math.h>
//#include <ctype.h>
#include "obiview.h" #include "obiview.h"
#include "obidms.h" #include "obidms.h"
@ -633,7 +633,6 @@ static int enlarge_view_file(Obiview_p view, size_t new_size)
multiple = ceil((double) new_size / (double) getpagesize()); multiple = ceil((double) new_size / (double) getpagesize());
rounded_new_size = multiple * getpagesize(); rounded_new_size = multiple * getpagesize();
// Enlarge the file // Enlarge the file
if (ftruncate(obiview_file_descriptor, rounded_new_size) < 0) if (ftruncate(obiview_file_descriptor, rounded_new_size) < 0)
{ {
@ -877,7 +876,6 @@ static OBIDMS_column_p clone_column_in_view(Obiview_p view, const char* column_n
OBIDMS_column_p column = NULL; OBIDMS_column_p column = NULL;
OBIDMS_column_p new_column = NULL; OBIDMS_column_p new_column = NULL;
OBIDMS_column_p column_buffer; OBIDMS_column_p column_buffer;
bool found;
// Check that the view is not read-only // Check that the view is not read-only
if (view->read_only) if (view->read_only)
@ -887,7 +885,6 @@ static OBIDMS_column_p clone_column_in_view(Obiview_p view, const char* column_n
return NULL; return NULL;
} }
found = false;
for (i=0; i<((view->infos)->column_count); i++) for (i=0; i<((view->infos)->column_count); i++)
{ {
if ((view->line_selection != NULL) || (!strcmp((((view->infos)->column_references)[i]).alias, column_name))) if ((view->line_selection != NULL) || (!strcmp((((view->infos)->column_references)[i]).alias, column_name)))
@ -2214,7 +2211,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
// TODO return a pointer on the column? // TODO return a pointer on the column?
int obi_view_add_column(Obiview_p view, int obi_view_add_column(Obiview_p view,
const char* column_name, char* column_name,
obiversion_t version_number, obiversion_t version_number,
const char* alias, const char* alias,
OBIType_t data_type, OBIType_t data_type,
@ -2234,6 +2231,8 @@ int obi_view_add_column(Obiview_p view,
OBIDMS_column_p column; OBIDMS_column_p column;
OBIDMS_column_p column_buffer; OBIDMS_column_p column_buffer;
//for ( ; *column_name; ++column_name) *column_name = tolower(*column_name);
// Check that the view is not read-only // Check that the view is not read-only
if (view->read_only) if (view->read_only)
{ {
@ -2603,11 +2602,8 @@ int obi_dms_has_unfinished_views(OBIDMS_p dms)
Obiview_infos_p view_infos; Obiview_infos_p view_infos;
char* view_name; char* view_name;
int ret_value; int ret_value;
char* to_delete[1000];
int d;
ret_value = 0; ret_value = 0;
d = 0;
// Look for unfinished views and delete them // Look for unfinished views and delete them
rewinddir(dms->view_directory); rewinddir(dms->view_directory);
@ -2743,7 +2739,7 @@ int obi_clean_unfinished_views(OBIDMS_p dms)
free(to_delete[i]); free(to_delete[i]);
} }
return 0; return ret_value;
} }

View File

@ -407,7 +407,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name);
* @author Celine Mercier (celine.mercier@metabarcoding.org) * @author Celine Mercier (celine.mercier@metabarcoding.org)
*/ */
int obi_view_add_column(Obiview_p view, int obi_view_add_column(Obiview_p view,
const char* column_name, char* column_name,
obiversion_t version_number, obiversion_t version_number,
const char* alias, const char* alias,
OBIType_t data_type, OBIType_t data_type,