Skip to content

Commit 43bff70

Browse files
committed
fixes #83 - code updates to support clang compilation / cleaned up some clang warnings
Signed-off-by: Ambalu, Robert <robert.ambalu@point72.com>
1 parent 5b4718d commit 43bff70

19 files changed

+78
-76
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,13 @@ else()
230230
-Wall \
231231
-Wno-deprecated-declarations \
232232
-Wno-deprecated \
233-
-Wno-maybe-uninitialized \
234233
")
235234
add_definitions(-DNDEBUG)
235+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
236+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
237+
-Wno-maybe-uninitialized \
238+
")
239+
endif()
236240
endif()
237241
endif()
238242

cpp/csp/adapters/parquet/ArrowSingleColumnArrayBuilder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class PrimitiveTypedArrayBuilder : public BaseTypedArrayBuilder<ValueType, Arrow
304304
protected:
305305
void pushValueToArray()
306306
{
307-
this -> m_builderPtr -> Append( *this -> m_value );
307+
[[maybe_unused]] auto status = this -> m_builderPtr -> Append( *this -> m_value );
308308
}
309309
};
310310

cpp/csp/adapters/parquet/ParquetOutputAdapter.h

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ParquetOutputHandler
3131
{
3232
}
3333

34+
virtual ~ParquetOutputHandler() {}
35+
3436
uint32_t getChunkSize() const;
3537

3638
virtual uint32_t getNumColumns() = 0;

cpp/csp/adapters/parquet/ParquetReader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class SingleTableParquetReader : public ParquetReader
376376
const std::optional<utils::Symbol> &symbol, const DialectGenericListReaderInterface::Ptr &listReaderInterface ) override
377377
{
378378
ParquetReader::addListSubscriber( column, inputAdapter, symbol, listReaderInterface);
379-
m_columnSubscriptionContainer.m_listColumnSubscriptions[column].push_back(ListColumnSubscriberInfo{inputAdapter, symbol, listReaderInterface});
379+
m_columnSubscriptionContainer.m_listColumnSubscriptions[column].push_back(ListColumnSubscriberInfo{{inputAdapter, symbol}, listReaderInterface});
380380
}
381381

382382
protected:

cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class MissingColumnAdapter : public ParquetColumnAdapter
134134

135135
bool isMissingColumn() const override{ return true; }
136136

137-
virtual CspTypePtr getNativeCspType() const
137+
virtual CspTypePtr getNativeCspType() const override
138138
{
139139
CSP_THROW( csp::RuntimeException, "Trying to get native type of a missing column " << getColumnName() );
140140
}
@@ -190,8 +190,7 @@ template< typename ValueType, typename ArrowArrayType >
190190
class NativeTypeColumnAdapter : public BaseTypedColumnAdapter<ValueType, ArrowArrayType>
191191
{
192192
public:
193-
using BASE = BaseTypedColumnAdapter<ValueType, ArrowArrayType>;
194-
using BASE::BaseTypedColumnAdapter;
193+
using BaseTypedColumnAdapter<ValueType, ArrowArrayType>::BaseTypedColumnAdapter;
195194
virtual CspTypePtr getNativeCspType() const override {return CspType::fromCType<ValueType>::type();}
196195

197196
protected:

cpp/csp/adapters/utils/JSONMessageWriter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class JSONMessageWriter : public MessageWriter
6363
}
6464

6565
private:
66-
void processTickImpl( const OutputDataMapper & dataMapper, const TimeSeriesProvider * sourcets )
66+
void processTickImpl( const OutputDataMapper & dataMapper, const TimeSeriesProvider * sourcets ) override
6767
{
6868
dataMapper.apply( *this, sourcets );
6969
}

cpp/csp/cppnodes/statsimpl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ class Quantile
11631163
int ft = floor( target );
11641164
int ct = ceil( target );
11651165

1166-
double qtl;
1166+
double qtl = 0.0;
11671167
#ifndef __clang__
11681168
switch ( m_interpolation )
11691169
{

cpp/csp/engine/CppNode.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ class CppNode : public csp::Node
161161
using InputWrapper::InputWrapper;
162162

163163
operator const T &() { return lastValue(); }
164-
const T & lastValue() const { return ts() -> lastValueTyped<T>(); }
164+
const T & lastValue() const { return ts() -> template lastValueTyped<T>(); }
165165

166-
const T & valueAtIndex( int32_t index ) const { return ts() -> valueAtIndex<T>( index ); }
166+
const T & valueAtIndex( int32_t index ) const { return ts() -> template valueAtIndex<T>( index ); }
167167
};
168168

169169
template<typename ElemWrapperT>
@@ -379,7 +379,7 @@ class CppNode : public csp::Node
379379

380380
T & reserveSpace()
381381
{
382-
return ts() -> reserveTickTyped<T>( m_node.cycleCount(), m_node.now() );
382+
return ts() -> template reserveTickTyped<T>( m_node.cycleCount(), m_node.now() );
383383
}
384384
};
385385

@@ -644,7 +644,7 @@ struct csp::CppNode::AlarmTypeHelper<csp::CppNode::Generic>
644644
}
645645

646646
#define INIT_CPPNODE_WITH_NAME( Class, Name ) \
647-
CSP csp; \
647+
[[maybe_unused]] CSP csp; \
648648
public: \
649649
const char * name() const override { return #Name; } \
650650
_STATIC_CREATE_METHOD( Class ) \

cpp/csp/engine/CspType.h

+44-41
Original file line numberDiff line numberDiff line change
@@ -169,47 +169,50 @@ class CspArrayType : public CspType
169169
CspTypePtr m_elemType;
170170
};
171171

172-
template<> struct CspType::Type::fromCType<std::_Bit_reference> { static constexpr CspType::Type type = CspType::Type::BOOL; };
173-
template<> struct CspType::Type::fromCType<bool> { static constexpr CspType::Type type = CspType::Type::BOOL; };
174-
template<> struct CspType::Type::fromCType<int8_t> { static constexpr CspType::Type type = CspType::Type::INT8; };
175-
template<> struct CspType::Type::fromCType<uint8_t> { static constexpr CspType::Type type = CspType::Type::UINT8; };
176-
template<> struct CspType::Type::fromCType<int16_t> { static constexpr CspType::Type type = CspType::Type::INT16; };
177-
template<> struct CspType::Type::fromCType<uint16_t> { static constexpr CspType::Type type = CspType::Type::UINT16; };
178-
template<> struct CspType::Type::fromCType<int32_t> { static constexpr CspType::Type type = CspType::Type::INT32; };
179-
template<> struct CspType::Type::fromCType<uint32_t> { static constexpr CspType::Type type = CspType::Type::UINT32; };
180-
template<> struct CspType::Type::fromCType<int64_t> { static constexpr CspType::Type type = CspType::Type::INT64; };
181-
template<> struct CspType::Type::fromCType<uint64_t> { static constexpr CspType::Type type = CspType::Type::UINT64; };
182-
template<> struct CspType::Type::fromCType<double> { static constexpr CspType::Type type = CspType::Type::DOUBLE; };
183-
template<> struct CspType::Type::fromCType<DateTime> { static constexpr CspType::Type type = CspType::Type::DATETIME; };
184-
template<> struct CspType::Type::fromCType<TimeDelta> { static constexpr CspType::Type type = CspType::Type::TIMEDELTA; };
185-
template<> struct CspType::Type::fromCType<Date> { static constexpr CspType::Type type = CspType::Type::DATE; };
186-
template<> struct CspType::Type::fromCType<Time> { static constexpr CspType::Type type = CspType::Type::TIME; };
187-
template<> struct CspType::Type::fromCType<CspEnum> { static constexpr CspType::Type type = CspType::Type::ENUM; };
188-
template<> struct CspType::Type::fromCType<CspType::StringCType> { static constexpr CspType::Type type = CspType::Type::STRING; };
189-
template<> struct CspType::Type::fromCType<StructPtr> { static constexpr CspType::Type type = CspType::Type::STRUCT; };
190-
template<typename T> struct CspType::Type::fromCType<TypedStructPtr<T>> { static constexpr CspType::Type type = CspType::Type::STRUCT; };
191-
template<> struct CspType::Type::fromCType<DialectGenericType> { static constexpr CspType::Type type = CspType::Type::DIALECT_GENERIC; };
192-
template<typename T> struct CspType::Type::fromCType<std::vector<T>> { static constexpr CspType::Type type = CspType::Type::ARRAY; };
193-
194-
template<> struct CspType::Type::toCType<CspType::Type::BOOL,void> { using type = bool; };
195-
template<> struct CspType::Type::toCType<CspType::Type::INT8,void> { using type = int8_t; };
196-
template<> struct CspType::Type::toCType<CspType::Type::UINT8,void> { using type = uint8_t; };
197-
template<> struct CspType::Type::toCType<CspType::Type::INT16,void> { using type = int16_t; };
198-
template<> struct CspType::Type::toCType<CspType::Type::UINT16,void> { using type = uint16_t; };
199-
template<> struct CspType::Type::toCType<CspType::Type::INT32,void> { using type = int32_t; };
200-
template<> struct CspType::Type::toCType<CspType::Type::UINT32,void> { using type = uint32_t; };
201-
template<> struct CspType::Type::toCType<CspType::Type::INT64,void> { using type = int64_t; };
202-
template<> struct CspType::Type::toCType<CspType::Type::UINT64,void> { using type = uint64_t; };
203-
template<> struct CspType::Type::toCType<CspType::Type::DOUBLE,void> { using type = double; };
204-
template<> struct CspType::Type::toCType<CspType::Type::DATETIME,void> { using type = DateTime; };
205-
template<> struct CspType::Type::toCType<CspType::Type::TIMEDELTA,void> { using type = TimeDelta; };
206-
template<> struct CspType::Type::toCType<CspType::Type::DATE,void> { using type = Date; };
207-
template<> struct CspType::Type::toCType<CspType::Type::TIME,void> { using type = Time; };
208-
template<> struct CspType::Type::toCType<CspType::Type::ENUM,void> { using type = CspEnum; };
209-
template<> struct CspType::Type::toCType<CspType::Type::STRING,void> { using type = CspType::StringCType; };
210-
template<> struct CspType::Type::toCType<CspType::Type::STRUCT,void> { using type = StructPtr; };
211-
template<> struct CspType::Type::toCType<CspType::Type::DIALECT_GENERIC,void> { using type = DialectGenericType; };
212-
template<typename T> struct CspType::Type::toCType<CspType::Type::ARRAY,T> { using type = std::vector<T>; };
172+
#ifndef __clang__
173+
template<> struct CspType::Type::fromCType<std::_Bit_reference> { static constexpr CspType::Type type = CspType::Type::BOOL; };
174+
#endif
175+
176+
template<> struct CspType::TypeTraits::fromCType<bool> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::BOOL; };
177+
template<> struct CspType::TypeTraits::fromCType<int8_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::INT8; };
178+
template<> struct CspType::TypeTraits::fromCType<uint8_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::UINT8; };
179+
template<> struct CspType::TypeTraits::fromCType<int16_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::INT16; };
180+
template<> struct CspType::TypeTraits::fromCType<uint16_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::UINT16; };
181+
template<> struct CspType::TypeTraits::fromCType<int32_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::INT32; };
182+
template<> struct CspType::TypeTraits::fromCType<uint32_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::UINT32; };
183+
template<> struct CspType::TypeTraits::fromCType<int64_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::INT64; };
184+
template<> struct CspType::TypeTraits::fromCType<uint64_t> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::UINT64; };
185+
template<> struct CspType::TypeTraits::fromCType<double> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::DOUBLE; };
186+
template<> struct CspType::TypeTraits::fromCType<DateTime> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::DATETIME; };
187+
template<> struct CspType::TypeTraits::fromCType<TimeDelta> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::TIMEDELTA; };
188+
template<> struct CspType::TypeTraits::fromCType<Date> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::DATE; };
189+
template<> struct CspType::TypeTraits::fromCType<Time> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::TIME; };
190+
template<> struct CspType::TypeTraits::fromCType<CspEnum> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::ENUM; };
191+
template<> struct CspType::TypeTraits::fromCType<CspType::StringCType> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::STRING; };
192+
template<> struct CspType::TypeTraits::fromCType<StructPtr> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::STRUCT; };
193+
template<typename T> struct CspType::TypeTraits::fromCType<TypedStructPtr<T>> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::STRUCT; };
194+
template<> struct CspType::TypeTraits::fromCType<DialectGenericType> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::DIALECT_GENERIC; };
195+
template<typename T> struct CspType::TypeTraits::fromCType<std::vector<T>> { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::ARRAY; };
196+
197+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::BOOL,void> { using type = bool; };
198+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::INT8,void> { using type = int8_t; };
199+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::UINT8,void> { using type = uint8_t; };
200+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::INT16,void> { using type = int16_t; };
201+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::UINT16,void> { using type = uint16_t; };
202+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::INT32,void> { using type = int32_t; };
203+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::UINT32,void> { using type = uint32_t; };
204+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::INT64,void> { using type = int64_t; };
205+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::UINT64,void> { using type = uint64_t; };
206+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::DOUBLE,void> { using type = double; };
207+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::DATETIME,void> { using type = DateTime; };
208+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::TIMEDELTA,void> { using type = TimeDelta; };
209+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::DATE,void> { using type = Date; };
210+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::TIME,void> { using type = Time; };
211+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::ENUM,void> { using type = CspEnum; };
212+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::STRING,void> { using type = CspType::StringCType; };
213+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::STRUCT,void> { using type = StructPtr; };
214+
template<> struct CspType::TypeTraits::toCType<CspType::TypeTraits::DIALECT_GENERIC,void> { using type = DialectGenericType; };
215+
template<typename T> struct CspType::TypeTraits::toCType<CspType::TypeTraits::ARRAY,T> { using type = std::vector<T>; };
213216

214217
template<> struct CspType::fromCType<bool> { static CspTypePtr & type() { return CspType::BOOL(); } };
215218
template<> struct CspType::fromCType<int8_t> { static CspTypePtr & type() { return CspType::INT8(); } };

cpp/csp/engine/DynamicEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef _IN_CSP_ENGINE_DYNAMICENGINE_H
2-
#define _IN_CSP_ENGINE_DUNAMICENGINE_H
2+
#define _IN_CSP_ENGINE_DYNAMICENGINE_H
33

44
#include <csp/engine/Engine.h>
55
#include <csp/engine/OutputAdapter.h>

cpp/csp/engine/Feedback.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ inline FeedbackOutputAdapter<T>::FeedbackOutputAdapter( csp::Engine * engine,
6262
template<typename T>
6363
inline void FeedbackOutputAdapter<T>::executeImpl()
6464
{
65-
m_boundInput -> pushTick( input() -> lastValueTyped<T>() );
65+
m_boundInput -> pushTick( input() -> template lastValueTyped<T>() );
6666
}
6767

6868
}

cpp/csp/engine/PendingPushEvents.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace csp
88
{
99

10-
class PushGroup;
10+
struct PushGroup;
1111
class PushInputAdapters;
1212

1313
class PendingPushEvents

cpp/csp/engine/RootEngine.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Dictionary;
2222
class EndCycleListener
2323
{
2424
public:
25+
virtual ~EndCycleListener() {};
2526
virtual void onEndCycle() = 0;
2627

2728
bool isDirty() const { return m_dirty; }

cpp/csp/engine/Struct.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@ class StringStructField final : public NonNativeStructField
263263
setIsSet( s );
264264
}
265265

266-
virtual void copyFrom( const Struct * src, Struct * dest ) const
266+
virtual void copyFrom( const Struct * src, Struct * dest ) const override
267267
{
268268
value( dest ) = value( src );
269269
}
270270

271-
virtual bool isEqual( const Struct * x, const Struct * y ) const
271+
virtual bool isEqual( const Struct * x, const Struct * y ) const override
272272
{
273273
return value( x ) == value( y );
274274
}
275275

276-
virtual size_t hash( const Struct * x ) const
276+
virtual size_t hash( const Struct * x ) const override
277277
{
278278
return std::hash<CType>()( value( x ) );
279279
}

cpp/csp/python/InitHelper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ inline InitHelper::InitCallback InitHelper::moduleMethodsCallback( PyMethodDef *
7777

7878
inline InitHelper::InitCallback InitHelper::moduleMethod( const char * name, PyCFunction func, int flags, const char * doc )
7979
{
80-
PyMethodDef defs[2]{ { name, func, flags, doc }, nullptr };
80+
PyMethodDef defs[2]{ { name, func, flags, doc }, { nullptr } };
8181

8282
//Note that we rely on the lambda closure to keep the lifetime of defs which is kept by ptr
8383
//m_callbacks will keep the InitCallback around for the life of the program

cpp/csp/python/PyCspType.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ static_assert( alignof( csp::DialectGenericType ) == alignof( csp::python::PyObj
1212
namespace csp
1313
{
1414
template<>
15-
struct CspType::Type::fromCType<csp::python::PyObjectPtr>
15+
struct CspType::TypeTraits::fromCType<csp::python::PyObjectPtr>
1616
{
17-
static constexpr csp::CspType::Type type = csp::CspType::Type::DIALECT_GENERIC;
17+
static constexpr csp::CspType::TypeTraits::_enum type = csp::CspType::TypeTraits::DIALECT_GENERIC;
1818
};
1919

2020
}

0 commit comments

Comments
 (0)