Skip to content

Commit

Permalink
Revert symbol visibility changes (#390)
Browse files Browse the repository at this point in the history
* Revert "Use hidden visibility for symbols for non-windows platforms (#341)"

This reverts commit 4153d01.

Signed-off-by: Adam Glustein <[email protected]>

* Remove CSP_PUBLIC from autogen build

Signed-off-by: Adam Glustein <[email protected]>

---------

Signed-off-by: Adam Glustein <[email protected]>
  • Loading branch information
AdamGlustein authored Nov 13, 2024
1 parent 6a08733 commit 8274827
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 47 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ else()
if(CSP_BUILD_NO_CXX_ABI)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
if (COVERAGE)
# TODO windows
add_compile_options(--coverage)
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ build-debug: ## build the library ( DEBUG ) - May need a make clean when switch
build-conda: ## build the library in Conda
python setup.py build build_ext --csp-no-vcpkg --inplace

build-conda-debug: ## build the library ( DEBUG ) - in Conda
SKBUILD_CONFIGURE_OPTIONS="" DEBUG=1 python setup.py build build_ext --csp-no-vcpkg --inplace

install: ## install library
python -m pip install .

Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/kafka/KafkaAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct KafkaStatusMessageTypeTraits
using KafkaStatusMessageType = csp::Enum<KafkaStatusMessageTypeTraits>;

//Top level AdapterManager object for all kafka adapters in the engine
class CSP_PUBLIC KafkaAdapterManager final : public csp::AdapterManager
class KafkaAdapterManager final : public csp::AdapterManager
{
public:
KafkaAdapterManager( csp::Engine * engine, const Dictionary & properties );
Expand Down
4 changes: 2 additions & 2 deletions cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DialectGenericListReaderInterface
};

template< typename T >
class CSP_PUBLIC TypedDialectGenericListReaderInterface : public DialectGenericListReaderInterface
class TypedDialectGenericListReaderInterface : public DialectGenericListReaderInterface
{
public:
using Ptr = std::shared_ptr<TypedDialectGenericListReaderInterface<T>>;
Expand All @@ -45,4 +45,4 @@ class CSP_PUBLIC TypedDialectGenericListReaderInterface : public DialectGenericL

}

#endif
#endif
2 changes: 1 addition & 1 deletion cpp/csp/adapters/parquet/ParquetInputAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace csp::adapters::parquet


//Top level AdapterManager object for all parquet adapters in the engine
class CSP_PUBLIC ParquetInputAdapterManager final : public csp::AdapterManager
class ParquetInputAdapterManager final : public csp::AdapterManager
{
public:
using GeneratorPtr = csp::Generator<std::string, csp::DateTime, csp::DateTime>::Ptr;
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ParquetOutputFilenameAdapter;
class ParquetDictBasketOutputWriter;

//Top level AdapterManager object for all parquet adapters in the engine
class CSP_PUBLIC ParquetOutputAdapterManager final : public csp::AdapterManager
class ParquetOutputAdapterManager final : public csp::AdapterManager
{
public:
using FileVisitorCallback = std::function<void(const std::string &)>;
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ void ListColumnAdapter<ValueArrayType, ValueType>::readCurValue()
if( this -> m_curChunkArray -> IsValid( curRow ) )
{
auto values = this -> m_curChunkArray -> value_slice( curRow );
auto typedValues = std::static_pointer_cast<ValueArrayType>( values );
auto typedValues = std::dynamic_pointer_cast<ValueArrayType>( values );

auto arrayValue = m_listReader -> create( typedValues -> length() );
auto* internalBuffer = m_listReader -> getRawDataBuffer( arrayValue );
Expand Down
6 changes: 4 additions & 2 deletions cpp/csp/adapters/websocket/ClientAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ struct WebsocketClientStatusTypeTraits

using ClientStatusType = Enum<WebsocketClientStatusTypeTraits>;

class CSP_PUBLIC ClientAdapterManager final : public AdapterManager
class ClientAdapterManager final : public AdapterManager
{


public:
ClientAdapterManager(
Engine * engine,
Expand Down Expand Up @@ -76,4 +78,4 @@ class CSP_PUBLIC ClientAdapterManager final : public AdapterManager

}

#endif
#endif
4 changes: 2 additions & 2 deletions cpp/csp/core/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace csp
{

class CSP_PUBLIC Exception : public std::exception
class Exception : public std::exception
{
public:
Exception( const char * exType, const std::string & description, const char * file, const char * func, int line ) :
Expand Down Expand Up @@ -59,7 +59,7 @@ class CSP_PUBLIC Exception : public std::exception
};

#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define CSP_DECLARE_EXCEPTION( DerivedException, BaseException ) class CSP_PUBLIC DerivedException : public BaseException { public: DerivedException( const char * exType, const std::string &r, const char * file, const char * func, int line ) : BaseException( exType, r, file, func, line ) {} };
#define CSP_DECLARE_EXCEPTION( DerivedException, BaseException ) class DerivedException : public BaseException { public: DerivedException( const char * exType, const std::string &r, const char * file, const char * func, int line ) : BaseException( exType, r, file, func, line ) {} };

CSP_DECLARE_EXCEPTION( AssertionError, Exception )
CSP_DECLARE_EXCEPTION( RuntimeException, Exception )
Expand Down
11 changes: 5 additions & 6 deletions cpp/csp/core/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#undef ERROR
#undef GetMessage

#define CSP_LOCAL
#define CSP_PUBLIC __declspec(dllexport)
#define DLL_LOCAL

#ifdef CSPTYPESIMPL_EXPORTS
#define CSPTYPESIMPL_EXPORT __declspec(dllexport)
Expand Down Expand Up @@ -90,11 +89,11 @@ inline uint8_t ffs(uint64_t n)
}

#else
#define CSPIMPL_EXPORT __attribute__ ((visibility ("default")))
#define CSPTYPESIMPL_EXPORT __attribute__ ((visibility ("default")))

#define CSP_LOCAL __attribute__ ((visibility ("hidden")))
#define CSP_PUBLIC __attribute__ ((visibility ("default")))
#define CSPIMPL_EXPORT
#define CSPTYPESIMPL_EXPORT

#define DLL_LOCAL __attribute__ ((visibility ("hidden")))

#define START_PACKED
#define END_PACKED __attribute__((packed))
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/AdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool ManagedSimInputAdapter::pushNullTick()
return true;
}

class CSP_PUBLIC AdapterManager : public EngineOwned
class AdapterManager : public EngineOwned
{
public:
AdapterManager( csp::Engine * );
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/Feedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FeedbackOutputAdapter final : public OutputAdapter
};

template<typename T>
class CSP_PUBLIC FeedbackInputAdapter final : public InputAdapter
class FeedbackInputAdapter final : public InputAdapter
{
public:
using InputAdapter::InputAdapter;
Expand Down
4 changes: 2 additions & 2 deletions cpp/csp/engine/Struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ class Struct
void decref()
{
//Work around GCC12 bug mis-identifying this code as use-after-free
#if defined(__linux__) && !defined(__clang__)
#ifdef __linux__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
if( --hidden() -> refcount == 0 )
delete this;
#if defined(__linux__) && !defined(__clang__)
#ifdef __linux__
#pragma GCC diagnostic pop
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/python/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace csp::python
{

class CSP_PUBLIC PythonPassthrough : public csp::Exception
class PythonPassthrough : public csp::Exception
{
public:
PythonPassthrough( const char * exType, const std::string &r, const char * file,
Expand Down
19 changes: 1 addition & 18 deletions cpp/csp/python/InitHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace csp::python
{

class CSP_LOCAL InitHelper
class DLL_LOCAL InitHelper
{
public:
~InitHelper() {}
Expand Down Expand Up @@ -111,21 +111,4 @@ inline bool InitHelper::execute( PyObject * module )
}

}

//PyMODINIT_FUNC in Python <3.9 doesn't export the function/make visible
//this is required since we build with hidden visibility by default
//the below macro code can be removed once 3.8 support is dropped
//
//see similar issues:
//https://github.com/scipy/scipy/issues/15996
//https://github.com/mesonbuild/meson/pull/10369

#if PY_VERSION_HEX < 0x03090000
#ifdef PyMODINIT_FUNC
#undef PyMODINIT_FUNC
#endif

#define PyMODINIT_FUNC extern "C" CSP_PUBLIC PyObject*
#endif

#endif
2 changes: 1 addition & 1 deletion cpp/csp/python/PyCspEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct CSPTYPESIMPL_EXPORT PyCspEnumMeta : public PyHeapTypeObject
static PyTypeObject PyType;
};

//TODO Windows - need to figure out why adding CSP_PUBLIC to this class leads to weird compilation errors on CspEnumMeta's unordered_map...
//TODO Windows - need to figure out why adding DLL_PUBLIC to this class leads to weird compilation errors on CspEnumMeta's unordered_map...

//This is an extension of csp::CspEnumMeta for python dialect, we need it in order to
//keep a reference to the python enum type from conversion to/from csp::CspEnumMeta <-> PyObject properly
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/python/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(CSP_BUILD_PARQUET_ADAPTER)
endif()
target_link_libraries(parquetadapterimpl csp_core csp_engine cspimpl csp_parquet_adapter)
target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR} "${VENDORED_PYARROW_ROOT}")
target_compile_definitions(parquetadapterimpl PUBLIC ARROW_PYTHON_STATIC -DARROW_PYTHON_EXPORT=)
target_compile_definitions(parquetadapterimpl PUBLIC ARROW_PYTHON_STATIC)
install(TARGETS parquetadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR} )
endif()

Expand Down
4 changes: 2 additions & 2 deletions csp/build/csp_autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _generate_enum_class(self, enum_type):
cspenum_decls = "\n".join(f" static {enum_name} {x.name};" for x in enum_type)

out = f"""
class CSP_PUBLIC {enum_name} : public csp::CspEnum
class {enum_name} : public csp::CspEnum
{{
public:
// Raw value quick access
Expand Down Expand Up @@ -315,7 +315,7 @@ def _generate_struct_class(self, struct_type):
)

out = f"""
class CSP_PUBLIC {struct_name} : public {base_class}
class {struct_name} : public {base_class}
{{
public:
Expand Down

0 comments on commit 8274827

Please sign in to comment.