Skip to content

Commit

Permalink
gcc/clang (-fvisibility=hidden): corrections to compile and work prop…
Browse files Browse the repository at this point in the history
…erly (#4394)

* fix(ActiveRecord): missing ActiveRecordLib_API definitions for clang/gcc.

* fix(FPEnvironment): export FPEnvironmentImpl classes (#4393, #3331)

* fix(Crypto): export *Impl classes used from inlines (#4393, #3331)

* fix(Dynamic): explicitly instantiate and export Dynamic::Struct for string and int (-fvisibility=hidden) (#4393, #3331)

* fix(JSON): explicitly instantiate and export SharedPtr for JSON::Array and JSON::Object (-fvisibility=hidden) (#4393, #3331)

* enh(CMake): Set symbol visibility to hidden (#4393, #3331)

* enh(configure): user c++17 standard for iphone, Darwin and ARM-Linux.

* fix(UTF): explicitly instantiate and export 16 and 32-bit strings (-fvisibility=hidden) (#4393, #3331)

* fix(RecordSet): make Extraction.h internal and instantiate RecordsSet::column template functions only for supported types. (-fvisibility=hidden) (#4393, #3331)

* fix(UTF): fix explicitly instantiation on Windows (-fvisibility=hidden) (#4393, #3331)

* enh(CMake): Add github jobs for macOS with visibility set to hidden (#4393, #3331)

* fix(CppParser): Add missing declarations for CppParser_API (#4393, #3331)

* enh(CMake): Enable more options in github jobs for macOS with visibility set to hidden (#4393, #3331)

* fix(MongoDB): Add missing MongoDB_API (#4393, #3331)
  • Loading branch information
matejk committed Jan 17, 2024
1 parent 8b29c36 commit b574503
Show file tree
Hide file tree
Showing 28 changed files with 453 additions and 100 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,36 @@ jobs:
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh
macos-clang-make-visibility-hidden:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install openssl@1.1 mysql-client unixodbc libpq
- run: >-
./configure --everything --no-prefix --cflags="-fvisibility=hidden" --omit=PDF
--odbc-include=/usr/local/opt/unixodbc/include --odbc-lib=/usr/local/opt/unixodbc/lib
--mysql-include=/usr/local/opt/mysql-client/include --mysql-lib=/usr/local/opt/mysql-client/lib
--include-path="/usr/local/opt/openssl@1.1/include" --library-path="/usr/local/opt/openssl@1.1/lib" &&
make all -s -j4
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
max_attempts: 3
retry_on: any
command: >-
sudo -s
CPPUNIT_IGNORE="
CppUnit::TestCaller<ThreadTest>.testTrySleep,
CppUnit::TestCaller<TimestampTest>.testTimestamp,
CppUnit::TestCaller<ExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<SyslogTest>.testOldBSD,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh
macos-clang-cmake-openssl:
runs-on: macos-12
steps:
Expand Down Expand Up @@ -270,6 +300,31 @@ jobs:
PWD=`pwd`
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)|(Redis)"
macos-clang-cmake-openssl3-visibility-hidden:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install openssl@3 mysql-client unixodbc libpq
- run: cmake -S. -Bcmake-build -DCMAKE_CXX_VISIBILITY_PRESET=hidden -DENABLE_ENCODINGS_COMPILER=ON -DENABLE_PDF=ON -DENABLE_SEVENZIP=ON -DENABLE_CPPPARSER=ON -DENABLE_TESTS=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3 -DMYSQL_ROOT_DIR=/usr/local/opt/mysql-client && cmake --build cmake-build --target all
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
max_attempts: 3
retry_on: any
command: >-
cd cmake-build &&
sudo -s
CPPUNIT_IGNORE="
CppUnit::TestCaller<ThreadTest>.testTrySleep,
CppUnit::TestCaller<TimestampTest>.testTimestamp,
CppUnit::TestCaller<ExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
PWD=`pwd`
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)|(Redis)"
macos-clang-make-openssl3-tsan:
runs-on: macos-12
steps:
Expand Down
6 changes: 5 additions & 1 deletion ActiveRecord/include/Poco/ActiveRecord/ActiveRecordLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@


#if !defined(ActiveRecordLib_API)
#define ActiveRecordLib_API
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
#define ActiveRecordLib_API __attribute__ ((visibility ("default")))
#else
#define ActiveRecordLib_API
#endif
#endif


Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ message(STATUS "[cmake] Build type: ${CMAKE_BUILD_TYPE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
message(STATUS "[cmake] Build with cxx flags: ${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")
message(STATUS "[cmake] Build with c flags: ${CMAKE_C_FLAGS_${BUILD_TYPE}} ${CMAKE_C_FLAGS}")
message(STATUS "[cmake] C++ symbol visibility: ${CMAKE_CXX_VISIBILITY_PRESET}")

foreach(component ${Poco_COMPONENTS})
message(STATUS "Building: ${component}")
Expand Down
6 changes: 5 additions & 1 deletion CppParser/include/Poco/CppParser/CppParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@


#if !defined(CppParser_API)
#define CppParser_API
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
#define CppParser_API __attribute__ ((visibility ("default")))
#else
#define CppParser_API
#endif
#endif


Expand Down
2 changes: 1 addition & 1 deletion Crypto/include/Poco/Crypto/CipherKeyImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Poco {
namespace Crypto {


class CipherKeyImpl: public RefCountedObject
class Crypto_API CipherKeyImpl: public RefCountedObject
/// An implementation of the CipherKey class for OpenSSL's crypto library.
{
public:
Expand Down
2 changes: 1 addition & 1 deletion Crypto/include/Poco/Crypto/ECKeyImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class X509Certificate;
class PKCS12Container;


class ECKeyImpl: public KeyPairImpl
class Crypto_API ECKeyImpl: public KeyPairImpl
/// Elliptic Curve key clas implementation.
{
public:
Expand Down
2 changes: 1 addition & 1 deletion Crypto/include/Poco/Crypto/KeyPairImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Poco {
namespace Crypto {


class KeyPairImpl: public Poco::RefCountedObject
class Crypto_API KeyPairImpl: public Poco::RefCountedObject
/// Class KeyPairImpl
{
public:
Expand Down
2 changes: 1 addition & 1 deletion Crypto/include/Poco/Crypto/RSAKeyImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class X509Certificate;
class PKCS12Container;


class RSAKeyImpl: public KeyPairImpl
class Crypto_API RSAKeyImpl: public KeyPairImpl
/// class RSAKeyImpl
{
public:
Expand Down
86 changes: 4 additions & 82 deletions Data/include/Poco/Data/RecordSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "Poco/Data/Data.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/Extraction.h"
#include "Poco/Data/BulkExtraction.h"
#include "Poco/Data/Statement.h"
#include "Poco/Data/RowIterator.h"
Expand Down Expand Up @@ -166,100 +165,23 @@ class Data_API RecordSet: private Statement
/// Returns the number of columns in the recordset.

template <class C>
const Column<C>& column(const std::string& name) const
const Column<C>& column(const std::string& name) const;
/// Returns the reference to the first Column with the specified name.
{
if (isBulkExtraction())
{
using E = InternalBulkExtraction<C>;
return columnImpl<C,E>(name);
}
else
{
using E = InternalExtraction<C>;
return columnImpl<C,E>(name);
}
}

template <class C>
const Column<C>& column(std::size_t pos) const
/// Returns the reference to column at specified position.
{
if (isBulkExtraction())
{
using E = InternalBulkExtraction<C>;
return columnImpl<C,E>(pos);
}
else
{
using E = InternalExtraction<C>;
return columnImpl<C,E>(pos);
}
}
const Column<C>& column(std::size_t pos) const;

Row& row(std::size_t pos);
/// Returns reference to row at position pos.
/// Rows are lazy-created and cached.

template <class T>
const T& value(std::size_t col, std::size_t row, bool useFilter = true) const
const T& value(std::size_t col, std::size_t row, bool useFilter = true) const;
/// Returns the reference to data value at [col, row] location.
{
if (useFilter && isFiltered() && !isAllowed(row))
throw InvalidAccessException("Row not allowed");

switch (storage())
{
case STORAGE_VECTOR:
{
using C = typename std::vector<T>;
return column<C>(col).value(row);
}
case STORAGE_LIST:
{
using C = typename std::list<T>;
return column<C>(col).value(row);
}
case STORAGE_DEQUE:
case STORAGE_UNKNOWN:
{
using C = typename std::deque<T>;
return column<C>(col).value(row);
}
default:
throw IllegalStateException("Invalid storage setting.");
}
}

template <class T>
const T& value(const std::string& name, std::size_t row, bool useFilter = true) const
const T& value(const std::string& name, std::size_t row, bool useFilter = true) const;
/// Returns the reference to data value at named column, row location.
{
if (useFilter && isFiltered() && !isAllowed(row))
throw InvalidAccessException("Row not allowed");

switch (storage())
{
case STORAGE_VECTOR:
{
using C = typename std::vector<T>;
return column<C>(name).value(row);
}
case STORAGE_LIST:
{
using C = typename std::list<T>;
return column<C>(name).value(row);
}
case STORAGE_DEQUE:
case STORAGE_UNKNOWN:
{
using C = typename std::deque<T>;
return column<C>(name).value(row);
}
default:
throw IllegalStateException("Invalid storage setting.");
}
}

Poco::Dynamic::Var value(std::size_t col, std::size_t row, bool checkFiltering = true) const;
/// Returns the data value at column, row location.
Expand Down
Loading

0 comments on commit b574503

Please sign in to comment.