Skip to content

Commit 44860a4

Browse files
committed
More warnings work
1 parent 105f14c commit 44860a4

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed

IsoSpec++/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
OPTFLAGS=-O3 -march=native -mtune=native
22
DEBUGFLAGS=-O0 -g -Werror -DISOSPEC_DEBUG -DDEBUG -D_GLIBCXX_DEBUG
3-
CXXFLAGS=-std=c++17 -Wall -pedantic -Wextra -Wshadow -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-old-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wno-sign-conversion -Wsign-promo -Wswitch-default -Wundef
3+
CXXFLAGS=-std=c++17 -Wall -pedantic -Wextra -Wshadow -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-old-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wno-sign-conversion -Wsign-promo -Wswitch-default -Wundef -Wshorten-64-to-32
44
SRCFILES=cwrapper.cpp allocator.cpp dirtyAllocator.cpp isoSpec++.cpp isoMath.cpp marginalTrek++.cpp operators.cpp element_tables.cpp misc.cpp mman.cpp fixedEnvelopes.cpp fasta.cpp
55

6-
all: unitylib
6+
all: syntax
7+
8+
syntax:
9+
$(CXX) $(CXXFLAGS) unity-build.cpp -fsyntax-only
710

811
unitylib:
912
$(CXX) $(CXXFLAGS) $(OPTFLAGS) unity-build.cpp -fPIC -shared -o libIsoSpec++.so

IsoSpec++/allocator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace IsoSpec
2121
{
2222

2323
template <typename T>
24-
Allocator<T>::Allocator(const int dim_, const int tabSize_): currentTab(new T[dim_ * tabSize_]), currentId(-1), dim(dim_), tabSize(tabSize_) {}
24+
Allocator<T>::Allocator(const size_t dim_, const size_t tabSize_): currentTab(new T[dim_ * tabSize_]), currentId(-1), dim(dim_), tabSize(tabSize_) {}
2525

2626

2727
template <typename T>
@@ -34,7 +34,7 @@ Allocator<T>::~Allocator()
3434
delete [] currentTab;
3535
}
3636

37-
for(unsigned int i = 0; i < prevTabs.size(); ++i)
37+
for(size_t i = 0; i < prevTabs.size(); ++i)
3838
delete [] prevTabs[i];
3939
}
4040

IsoSpec++/allocator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ namespace IsoSpec
2525

2626
template <typename T> inline void copyConf(
2727
const T* source, T* destination,
28-
int dim
28+
size_t dim
2929
){
3030
memcpy(destination, source, dim*sizeof(T));
3131
}
3232

3333
template <typename T> class Allocator
3434
{
3535
private:
36-
T* currentTab;
36+
T* currentTab;
3737
int currentId;
38-
const int dim, tabSize;
38+
const size_t dim, tabSize;
3939
pod_vector<T*> prevTabs;
4040

4141
public:
42-
explicit Allocator(const int dim, const int tabSize = 10000);
42+
explicit Allocator(const size_t dim, const size_t tabSize = 10000);
4343
~Allocator();
4444

4545
Allocator(const Allocator& other) = delete;

IsoSpec++/dirtyAllocator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace IsoSpec
2222
{
2323

2424
DirtyAllocator::DirtyAllocator(
25-
const int dim, const int tabSize_
25+
const size_t dim, const size_t tabSize_
2626
): tabSize(tabSize_)
2727
{
2828
cellSize = sizeof(double) + sizeof(int) * dim;
@@ -39,7 +39,7 @@ DirtyAllocator::DirtyAllocator(
3939

4040
DirtyAllocator::~DirtyAllocator()
4141
{
42-
for(unsigned int i = 0; i < prevTabs.size(); ++i) free(prevTabs[i]);
42+
for(size_t i = 0; i < prevTabs.size(); ++i) free(prevTabs[i]);
4343
free(currentTab);
4444
}
4545

IsoSpec++/dirtyAllocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class DirtyAllocator
2828
void* currentTab;
2929
void* currentConf;
3030
void* endOfTablePtr;
31-
const int tabSize;
31+
const size_t tabSize;
3232
int cellSize;
3333
pod_vector<void*> prevTabs;
3434

3535
public:
36-
explicit DirtyAllocator(const int dim, const int tabSize = 10000);
36+
explicit DirtyAllocator(const size_t dim, const size_t tabSize = 10000);
3737
~DirtyAllocator();
3838

3939
DirtyAllocator(const DirtyAllocator& other) = delete;

IsoSpec++/isoSpec++.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class ISOSPEC_EXPORT_SYMBOL IsoOrderedGeneratorTemplate: public IsoGenerator
247247
double currentLProb; /*!< The log-probability of the current isotopologue. */
248248
double currentMass; /*!< The mass of the current isotopologue. */
249249
double currentProb; /*!< The probability of the current isotopologue. */
250-
int ccount;
250+
long int ccount;
251251

252252
public:
253253
IsoOrderedGeneratorTemplate(const IsoOrderedGeneratorTemplate& other) = delete;
@@ -538,7 +538,7 @@ class ISOSPEC_EXPORT_SYMBOL IsoLayeredGeneratorTemplate : public IsoGenerator
538538

539539

540540
//! Recalculate the current partial log-probabilities, masses, and probabilities.
541-
ISOSPEC_FORCE_INLINE void recalc(int idx)
541+
ISOSPEC_FORCE_INLINE void recalc(size_t idx)
542542
{
543543
for(; idx > 0; idx--)
544544
{

IsoSpec++/misc.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ namespace IsoSpec
2727
{
2828

2929
inline double combinedSum(
30-
const int* conf, const std::vector<double>** valuesContainer, int dimNumber
30+
const int* conf, const std::vector<double>** valuesContainer, size_t dimNumber
3131
){
3232
double res = 0.0;
33-
for(int i = 0; i < dimNumber; i++)
33+
for(size_t i = 0; i < dimNumber; i++)
3434
res += (*(valuesContainer[i]))[conf[i]];
3535
return res;
3636
}
3737

3838
inline double combinedSum(
39-
const int* conf, const pod_vector<double>** valuesContainer, int dimNumber
39+
const int* conf, const pod_vector<double>** valuesContainer, size_t dimNumber
4040
){
4141
double res = 0.0;
42-
for(int i = 0; i < dimNumber; i++)
42+
for(size_t i = 0; i < dimNumber; i++)
4343
res += (*(valuesContainer[i]))[conf[i]];
4444
return res;
4545
}
@@ -135,9 +135,9 @@ template <typename T> static T* array_copy_nptr(const T* A, size_t size)
135135
return array_copy(A, size);
136136
}
137137

138-
template<typename T> void dealloc_table(T* tbl, int dim)
138+
template<typename T> void dealloc_table(T* tbl, size_t dim)
139139
{
140-
for(int i = 0; i < dim; i++)
140+
for(size_t i = 0; i < dim; i++)
141141
{
142142
delete tbl[i];
143143
}

0 commit comments

Comments
 (0)