Skip to content

Commit 38d0e5a

Browse files
authored
Clean up warnings from CSP code during build (#320)
* Clean up warnings from CSP code during build Signed-off-by: Adam Glustein <Adam.Glustein@Point72.com> * Enable -Werror for release gcc/clang builds Signed-off-by: Adam Glustein <Adam.Glustein@Point72.com> --------- Signed-off-by: Adam Glustein <Adam.Glustein@Point72.com>
1 parent 48d8de6 commit 38d0e5a

File tree

8 files changed

+27
-7
lines changed

8 files changed

+27
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ else()
194194
-O3 \
195195
-g0 \
196196
-Wall \
197+
-Werror \
197198
-Wno-deprecated-declarations \
198199
-Wno-deprecated \
199200
")

cpp/csp/adapters/parquet/ParquetOutputAdapter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ template< typename A, typename V = typename A::value_type >
140140
inline std::shared_ptr<::arrow::ArrayBuilder> makeArrayAndAttachToWriter( DialectGenericListWriterInterface::Ptr &listWriterInterface )
141141
{
142142
auto&& typedWriter = std::dynamic_pointer_cast<TypedDialectGenericListWriterInterface<V>>( listWriterInterface );
143+
auto& listWriterInterfaceRef = *listWriterInterface;
143144
CSP_TRUE_OR_THROW( typedWriter != nullptr, TypeError,
144145
"Expected " << typeid( TypedDialectGenericListWriterInterface<V> ).name() << " " << " got " <<
145-
typeid( *listWriterInterface ).name() );
146+
typeid( listWriterInterfaceRef ).name() );
146147

147148
auto res = std::make_shared<A>();
148149
typedWriter -> setWriteFunction(

cpp/csp/engine/Struct.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,15 @@ class Struct
756756
void decref()
757757
{
758758
//Work around GCC12 bug mis-identifying this code as use-after-free
759-
//#pragma GCC diagnostic push
760-
//#pragma GCC diagnostic ignored "-Wuse-after-free"
759+
#ifdef __linux__
760+
#pragma GCC diagnostic push
761+
#pragma GCC diagnostic ignored "-Wuse-after-free"
762+
#endif
761763
if( --hidden() -> refcount == 0 )
762764
delete this;
763-
//#pragma GCC diagnostic pop
765+
#ifdef __linux__
766+
#pragma GCC diagnostic pop
767+
#endif
764768
}
765769

766770

cpp/csp/python/PyStructFastList_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ static PyObject * PyStructFastList_reduce( PyStructFastList<StorageT> * self, Py
516516
{
517517
CSP_BEGIN_METHOD;
518518

519-
typename VectorWrapper<StorageT>::IndexType sz = self -> vector.size();
520519
PyObjectPtr list = PyObjectPtr::own( toPython( self -> vector.getVector(), self -> arrayType ) );
521520
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, list.ptr() );
522521
return result;

cpp/csp/python/PyStructList_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ static PyObject * PyStructList_reduce( PyStructList<StorageT> * self, PyObject *
302302
{
303303
CSP_BEGIN_METHOD;
304304

305-
typename VectorWrapper<StorageT>::IndexType sz = self -> vector.size();
306305
PyObjectPtr list = PyObjectPtr::own( toPython( self -> vector.getVector(), self -> arrayType ) );
307306
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, list.ptr() );
308307
return result;

cpp/csp/python/PyStructToJson.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ inline rapidjson::Value toJson( const TimeDelta& val, const CspType& typ, rapidj
7272
// Convert TimeDelta to <sign><seconds>.<microseconds>
7373
// sign( 1 ) + seconds ( 18 ) + '.'( 1 ) + microseconds( 9 ) + '\0'( 1 )
7474
char buf[32] = {};
75-
auto seconds = val.abs().asSeconds();
75+
long seconds = val.abs().asSeconds();
7676
auto microseconds = static_cast<unsigned>( val.abs().nanoseconds() / NANOS_PER_MICROSECOND );
7777
auto len = sprintf( buf, "%c%ld.%06u", ( val.sign() >= 0 ) ? '+' : '-', seconds, microseconds );
7878
rapidjson::Value res;

cpp/csp/python/adapters/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ if(CSP_BUILD_PARQUET_ADAPTER)
2929
${VENDORED_PYARROW_ROOT}/arrow/python/csv.cc
3030
${VENDORED_PYARROW_ROOT}/arrow/python/filesystem.cc)
3131
add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp ${ARROW_PYTHON_SRCS})
32+
# Ignore warning regarding static datetime API initialization coming from vendored Arrow code
33+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
34+
set_target_properties(parquetadapterimpl PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable")
35+
endif()
3236
target_link_libraries(parquetadapterimpl csp_core csp_engine cspimpl csp_parquet_adapter)
3337
target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR} "${VENDORED_PYARROW_ROOT}")
3438
target_compile_definitions(parquetadapterimpl PUBLIC ARROW_PYTHON_STATIC)

cpp/tests/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
add_subdirectory(core)
22
add_subdirectory(engine)
3+
4+
# Ignore bogus gcc warning which is coming from gtest headers
5+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651
6+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7+
set(SUBDIRS core engine)
8+
foreach(SUBDIR ${SUBDIRS})
9+
get_directory_property(SUBDIR_TARGETS DIRECTORY ${SUBDIR} BUILDSYSTEM_TARGETS)
10+
foreach(TARGET ${SUBDIR_TARGETS})
11+
set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS "-Wno-restrict")
12+
endforeach()
13+
endforeach()
14+
endif()

0 commit comments

Comments
 (0)