GitHub runner ubuntu 24.04 and resolve some issues (#4727)

This commit is contained in:
Matej Kenda 2024-10-09 21:53:49 +02:00 committed by GitHub
parent 13bbea759f
commit a1efeaa72d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 183 additions and 147 deletions

View File

@ -49,14 +49,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install g++-arm-linux-gnueabihf
- run: ./configure --config=X-Linux-gcc-arm --everything --omit=ApacheConnector,CppParser,Crypto,Data/MySQL,Data/PostgreSQL,Data/ODBC,JWT,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,SevenZip && make all -s -j4
- run: ./configure --config=X-Linux-gcc-arm --everything --omit=ApacheConnector,CppParser,Crypto,Data/MySQL,Data/PostgreSQL,Data/ODBC,JWT,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,SevenZip && make all -s -j6
linux-gcc-make:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev redis-server libmysqlclient-dev
- run: ./configure --everything --omit=PDF && make all -s -j4 && sudo make install
- run: ./configure --everything --omit=PDF && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -68,11 +68,11 @@ jobs:
./ci/runtests.sh
linux-gcc-make-cxx20:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev redis-server libmysqlclient-dev
- run: ./configure --config=Linux-c++20 --everything --omit=PDF && make all -s -j4 && sudo make install
- run: sudo apt -y update && sudo apt -y install libssl-dev libltdl-dev unixodbc-dev redis-server libmysqlclient-dev
- run: ./configure --config=Linux-c++20 --everything --omit=PDF && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -84,7 +84,7 @@ jobs:
./ci/runtests.sh
linux-gcc-make-asan:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization)
@ -95,8 +95,8 @@ jobs:
- run: sysctl kernel.randomize_va_space
- run: sudo sysctl vm.mmap_rnd_bits
- run: sudo sysctl -w vm.mmap_rnd_bits=28
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF && make all -s -j4 SANITIZEFLAGS=-fsanitize=address && sudo make install
- run: sudo apt -y update && sudo apt -y install libltdl-dev libssl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF && make all -s -j6 SANITIZEFLAGS=-fsanitize=address && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -108,7 +108,7 @@ jobs:
./ci/runtests.sh
linux-gcc-make-asan-no-soo:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization)
@ -119,8 +119,8 @@ jobs:
- run: sysctl kernel.randomize_va_space
- run: sudo sysctl vm.mmap_rnd_bits
- run: sudo sysctl -w vm.mmap_rnd_bits=28
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF --no-soo && make all -s -j4 SANITIZEFLAGS=-fsanitize=address && sudo make install
- run: sudo apt -y update && sudo apt -y install libssl-dev libltdl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF --no-soo && make all -s -j6 SANITIZEFLAGS=-fsanitize=address && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -132,11 +132,11 @@ jobs:
./ci/runtests.sh
linux-gcc-make-ubsan:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF && make all -s -j4 SANITIZEFLAGS=-fsanitize=undefined && sudo make install
- run: sudo apt -y update && sudo apt -y install libssl-dev libltdl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=PDF && make all -s -j6 SANITIZEFLAGS=-fsanitize=undefined && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -148,7 +148,7 @@ jobs:
./ci/runtests.sh
linux-gcc-make-tsan:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization)
@ -159,8 +159,8 @@ jobs:
- run: sysctl kernel.randomize_va_space
- run: sudo sysctl vm.mmap_rnd_bits
- run: sudo sysctl -w vm.mmap_rnd_bits=28
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=CppParser,Encodings,Data/MySQL,Data/ODBC,Data/PostgreSQL,MongoDB,PageCompiler,PDF,PocoDoc,ProGen,Redis,SevenZip && make all -s -j4 SANITIZEFLAGS=-fsanitize=thread && sudo make install
- run: sudo apt -y update && sudo apt -y install libssl-dev libltdl-dev unixodbc-dev libmysqlclient-dev redis-server
- run: ./configure --everything --no-samples --omit=CppParser,Encodings,Data/MySQL,Data/ODBC,Data/PostgreSQL,MongoDB,PageCompiler,PDF,PocoDoc,ProGen,Redis,SevenZip && make all -s -j6 SANITIZEFLAGS=-fsanitize=thread && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -170,7 +170,7 @@ jobs:
sudo -s ./ci/runtests.sh TSAN
linux-gcc-cmake:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server
@ -187,10 +187,10 @@ jobs:
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)"
linux-gcc-cmake-unbundled:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server libexpat1-dev zlib1g-dev libpcre3-dev libutf8proc-dev libpng-dev
- run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev libsqlite3-dev unixodbc-dev libmysqlclient-dev redis-server libexpat1-dev zlib1g-dev libpcre3-dev libutf8proc-dev libpng-dev
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON -DENABLE_PDF=ON && cmake --build cmake-build --target all
- uses: ./.github/actions/retry-action
with:
@ -208,7 +208,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install cmake ninja-build emscripten
- run: emcmake cmake -H. -B cmake-build -DENABLE_ACTIVERECORD_COMPILER=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=off && emmake cmake --build cmake-build --target all -j4
- run: emcmake cmake -H. -B cmake-build -DENABLE_ACTIVERECORD_COMPILER=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=off && emmake cmake --build cmake-build --target all -j6
# TODO: How to run unit tests in emscripten?
# - uses: ./.github/actions/retry-action
# with:
@ -235,7 +235,7 @@ jobs:
retry_on: any
command: >-
./configure --config=ARM-Linux --everything --omit=PDF,Crypto,NetSSL_OpenSSL,JWT,Data/MySQL,Data/ODBC,Data/PostgreSQL,PageCompiler,PageCompiler/File2Page &&
make all -s -j4 ARCHFLAGS="-mcpu=cortex-a8 -mfloat-abi=hard -mfpu=neon" TOOL=arm-linux-gnueabihf
make all -s -j6 ARCHFLAGS="-mcpu=cortex-a8 -mfloat-abi=hard -mfpu=neon" TOOL=arm-linux-gnueabihf
macos-clang-make:
runs-on: macos-13
@ -247,7 +247,7 @@ jobs:
--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
make all -s -j6
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -278,7 +278,7 @@ jobs:
--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
make all -s -j6
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -384,7 +384,7 @@ jobs:
--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@3/include" --library-path="/usr/local/opt/openssl@3/lib" &&
make all -s -j4 SANITIZEFLAGS=-fsanitize=thread
make all -s -j6 SANITIZEFLAGS=-fsanitize=thread
- uses: ./.github/actions/retry-action
with:
@ -414,7 +414,7 @@ jobs:
--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@3/include" --library-path="/usr/local/opt/openssl@3/lib" &&
make all -s -j4 SANITIZEFLAGS=-fsanitize=undefined
make all -s -j6 SANITIZEFLAGS=-fsanitize=undefined
- uses: ./.github/actions/retry-action
with:
@ -444,7 +444,7 @@ jobs:
--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@3/include" --library-path="/usr/local/opt/openssl@3/lib" &&
make all -s -j4 SANITIZEFLAGS=-fsanitize=address
make all -s -j6 SANITIZEFLAGS=-fsanitize=address
- uses: ./.github/actions/retry-action
with:
@ -628,7 +628,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev mysql-client
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/PostgreSQL,Data/SQLite,Data/ODBC,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/PostgreSQL,Data/SQLite,Data/ODBC,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -652,7 +652,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev odbc-postgresql
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/MySQL,Data/ODBC,Data/SQLite,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/MySQL,Data/ODBC,Data/SQLite,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -673,7 +673,7 @@ jobs:
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get -y update
sudo apt-get -y install redis
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/ODBC,Data/MySQL,Data/SQLite,Data/PostgreSQL,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/ODBC,Data/MySQL,Data/SQLite,Data/PostgreSQL,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -690,7 +690,7 @@ jobs:
- uses: actions/checkout@v4
- uses: supercharge/mongodb-github-action@1.10.0
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/ODBC,Data/MySQL,Data/SQLite,Data/PostgreSQL,Encodings,JSON,JWT,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/ODBC,Data/MySQL,Data/SQLite,Data/PostgreSQL,Encodings,JSON,JWT,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90
@ -736,7 +736,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev alien libaio1 gnupg2 curl odbcinst1debian2 libodbc1 odbcinst # libmysqlclient-dev mysql-client odbc-postgresql
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/MySQL,Data/PostgreSQL,Data/SQLite,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/MySQL,Data/PostgreSQL,Data/SQLite,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
# - name: Setup MySQL ODBC connector
# run: |
# wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.2/mysql-connector-odbc_8.2.0-1ubuntu22.04_amd64.deb
@ -777,7 +777,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt -y update
- run: ./configure --everything --no-samples --no-sqlparser --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/PostgreSQL,Data/MySQL,Data/ODBC,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j4 && sudo make install
- run: ./configure --everything --no-samples --no-sqlparser --omit=ActiveRecord,ApacheConnector,CppParser,Crypto,Data/PostgreSQL,Data/MySQL,Data/ODBC,Encodings,JSON,JWT,MongoDB,Net,NetSSL_OpenSSL,NetSSL_Win,PDF,PageCompiler,PocoDoc,ProGen,Prometheus,Redis,SevenZip,Util,XML,Zip && make all -s -j6 && sudo make install
- uses: ./.github/actions/retry-action
with:
timeout_minutes: 90

6
.gitignore vendored
View File

@ -43,9 +43,13 @@ config.build
config.make
# CLion #
########
#########
.idea/
# Qt Creator #
#########
build/
# CMake #
########
cmake_install.cmake

View File

@ -67,17 +67,15 @@ include(PocoMacros)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
set(POCO_SANITIZEFLAGS CACHE STRING "Compiler-dependent sanitizer flags (like -fsanitize=address or /fsanitize=address")
if(MSVC)
option(POCO_MT "Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF)
if(BUILD_SHARED_LIBS AND POCO_MT)
message(FATAL_ERROR "Cannot have both BUILD_SHARED_LIBS and POCO_MT")
endif()
if(POCO_SANITIZE_ASAN)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
endif()
option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF)
@ -193,11 +191,11 @@ option(ENABLE_ACTIVERECORD "Enable ActiveRecord" ON)
option(ENABLE_ACTIVERECORD_COMPILER "Enable ActiveRecord Compiler" ON)
if(ENABLE_ACTIVERECORD AND NOT ENABLE_DATA)
set(ENABLE_DATA ON CACHE BOOL "Enable Data" FORCE)
set(ENABLE_DATA ON CACHE BOOL "Enable Data" FORCE)
endif()
if(ENABLE_ACTIVERECORD AND NOT ENABLE_XML)
set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE)
set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE)
endif()
option(ENABLE_TESTS
@ -236,7 +234,7 @@ endif()
option(POCO_NO_FORK_EXEC "Set to OFF|ON (default is OFF) to disable use of fork() and exec*() which are not allowed on some Apple platforms (iOS, watchOS, iPadOS, tvOS)." OFF)
if(POCO_NO_FORK_EXEC)
add_definitions(-DPOCO_NO_FORK_EXEC=1)
add_definitions(-DPOCO_NO_FORK_EXEC=1)
endif()
option(POCO_ENABLE_STD_MUTEX "Set to OFF|NO using mutex from standard library (default OFF)" OFF)
@ -245,7 +243,7 @@ if (POCO_ENABLE_STD_MUTEX)
add_definitions(-DPOCO_ENABLE_STD_MUTEX)
endif ()
include(DefinePlatformSpecifc)
include(DefinePlatformSpecific)
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
set(Poco_COMPONENTS "")
@ -564,8 +562,8 @@ message(STATUS "[cmake] Build for OS version: ${CMAKE_SYSTEM_VERSION}")
message(STATUS "[cmake] Build for CPU type: ${CMAKE_SYSTEM_PROCESSOR}")
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] Build with C++ 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})

View File

@ -54,7 +54,7 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
std::vector<std::string> setup;
std::vector<Test*> tests;
for (int i = 1; i < args.size(); i++)
for (std::size_t i = 1; i < args.size(); i++)
{
const std::string& arg = args[i];
if (arg == "-wait")

View File

@ -31,7 +31,7 @@ namespace Dynamic {
class Var;
}
} // namespace Dynamic
namespace Data {
@ -56,6 +56,9 @@ public:
~Date();
/// Destroys the Date.
Date(const Date & ) = default;
Date(Date && ) = default;
int year() const;
/// Returns the year.
@ -151,7 +154,8 @@ inline bool Date::operator > (const Date& date) const
}
} } // namespace Poco::Data
} // namespace Data
} // namespace Poco
//
@ -171,39 +175,38 @@ public:
{
}
~VarHolderImpl()
{
}
~VarHolderImpl() = default;
VarHolderImpl() = delete;
const std::type_info& type() const
const std::type_info& type() const override
{
return typeid(Poco::Data::Date);
}
void convert(Poco::Timestamp& val) const
void convert(Poco::Timestamp& val) const override
{
DateTime dt;
dt.assign(_val.year(), _val.month(), _val.day());
val = dt.timestamp();
}
void convert(Poco::DateTime& val) const
void convert(Poco::DateTime& val) const override
{
val.assign(_val.year(), _val.month(), _val.day());
}
void convert(Poco::LocalDateTime& val) const
void convert(Poco::LocalDateTime& val) const override
{
val.assign(_val.year(), _val.month(), _val.day());
}
void convert(std::string& val) const
void convert(std::string& val) const override
{
DateTime dt(_val.year(), _val.month(), _val.day());
const DateTime dt(_val.year(), _val.month(), _val.day());
val = DateTimeFormatter::format(dt, "%Y/%m/%d");
}
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override
{
return cloneHolder(pVarHolder, _val);
}
@ -214,12 +217,12 @@ public:
}
private:
VarHolderImpl();
Poco::Data::Date _val;
};
} } // namespace Poco::Dynamic
} // namespace Dynamic
} // namespace Poco
#endif // Data_Date_INCLUDED

View File

@ -29,7 +29,7 @@ namespace Dynamic {
class Var;
}
} // namespace Dynamic
class DateTime;
@ -56,6 +56,9 @@ public:
~Time();
/// Destroys the Time.
Time(const Time & ) = default;
Time(Time && ) = default;
int hour() const;
/// Returns the hour.
@ -151,7 +154,8 @@ inline bool Time::operator > (const Time& time) const
}
} } // namespace Poco::Data
} // namespace Data
} // namespace Poco
//
@ -171,43 +175,42 @@ public:
{
}
~VarHolderImpl()
{
}
~VarHolderImpl() override = default;
VarHolderImpl() = delete;
const std::type_info& type() const
const std::type_info& type() const override
{
return typeid(Poco::Data::Time);
}
void convert(Poco::Timestamp& val) const
void convert(Poco::Timestamp& val) const override
{
Poco::DateTime dt;
dt.assign(dt.year(), dt.month(), dt.day(), _val.hour(), _val.minute(), _val.second());
val = dt.timestamp();
}
void convert(Poco::DateTime& val) const
void convert(Poco::DateTime& val) const override
{
Poco::DateTime dt;
dt.assign(dt.year(), dt.month(), dt.day(), _val.hour(), _val.minute(), _val.second());
val = dt;
}
void convert(Poco::LocalDateTime& val) const
void convert(Poco::LocalDateTime& val) const override
{
Poco::LocalDateTime ldt;
ldt.assign(ldt.year(), ldt.month(), ldt.day(), _val.hour(), _val.minute(), _val.second());
val = ldt;
}
void convert(std::string& val) const
void convert(std::string& val) const override
{
DateTime dt(0, 1, 1, _val.hour(), _val.minute(), _val.second());
const DateTime dt(0, 1, 1, _val.hour(), _val.minute(), _val.second());
val = DateTimeFormatter::format(dt, "%H:%M:%S");
}
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override
{
return cloneHolder(pVarHolder, _val);
}
@ -218,7 +221,6 @@ public:
}
private:
VarHolderImpl();
Poco::Data::Time _val;
};

View File

@ -354,7 +354,7 @@ void DataTest::testCLOB()
blobChrStr = CLOB(sss);
assertTrue (blobChrStr == blobNumStr);
std::string xyz = "xyz";
std::string xyz = "xyz";
vLOB = xyz;
blobChrStr = sss = vLOB.convert<std::string>();
assertTrue (0 == std::strncmp(xyz.c_str(), blobChrStr.rawContent(), blobChrStr.size()));
@ -1543,7 +1543,7 @@ void DataTest::testSQLParse()
void DataTest::testSQLChannel()
{
std::string dir = Path::tempHome();
const std::string dir = Path::tempHome();
AutoPtr<SQLChannel> pChannel = new SQLChannel();
pChannel->setProperty("directory", dir);
Stopwatch sw; sw.start();
@ -1555,16 +1555,19 @@ void DataTest::testSQLChannel()
}
Glob g("*.log.sql");
if (File(dir).exists())
{
DirectoryIterator it(dir);
DirectoryIterator end;
while (it != end)
{
if (g.match(it->path()))
DirectoryIterator it(dir);
const DirectoryIterator end;
while (it != end)
{
File(it->path()).remove();
if (g.match(it->path()))
{
File(it->path()).remove();
}
++it;
}
++it;
}
}
@ -1586,7 +1589,7 @@ void DataTest::testSQLChannel()
int count = 0;
DirectoryIterator it(dir);
DirectoryIterator end;
const DirectoryIterator end;
while (it != end)
{
if (g.match(it->path()))

View File

@ -40,7 +40,7 @@ public:
void testColumnList();
void testRow();
void testRowSort();
void testSimpleRowFormatter();;
void testSimpleRowFormatter();
void testJSONRowFormatter();
void testDateAndTime();
void testExternalBindingAndExtraction();

View File

@ -83,9 +83,11 @@ public:
_day = DateTimeParser::parseDayOfWeek(it, timestr[index].end());
++index;
}
[[fallthrough]];
case 2: // hh:mm
_hour = NumberParser::parse(timestr[index]);
++index;
[[fallthrough]];
case 1: // mm
_minute = NumberParser::parse(timestr[index]);
break;
@ -118,8 +120,8 @@ private:
_threshold += tsp;
}
while (!(_threshold.minute() == _minute &&
(-1 == _hour || _threshold.hour() == _hour) &&
(-1 == _day || _threshold.dayOfWeek() == _day)));
(-1 == _hour || _threshold.hour() == _hour) &&
(-1 == _day || _threshold.dayOfWeek() == _day)));
// round to :00.0 seconds
_threshold.assign(_threshold.year(), _threshold.month(), _threshold.day(), _threshold.hour(), _threshold.minute());
}

View File

@ -980,7 +980,9 @@ void Path::parseGuess(const std::string& path)
case '\\': hasBackslash = true; break;
case '/': hasSlash = true; break;
case '[': hasOpenBracket = true;
[[fallthrough]];
case ']': hasClosBracket = hasOpenBracket;
[[fallthrough]];
case ';': semiIt = it; break;
}
}

View File

@ -58,15 +58,16 @@ void ArrayTest::testConstruction()
typedef Poco::Array<Element,10> ElementArray;
ElementArray g;
for (unsigned i=0; i<g.size(); ++i) {
for (std::size_t i=0; i<g.size(); ++i)
{
g[i]._data = i;
}
for (unsigned i=0; i<g.size(); ++i) {
for (std::size_t i=0; i<g.size(); ++i)
{
assertTrue (g[i]._data == i);
}
}
void ArrayTest::testOperations()

View File

@ -24,7 +24,6 @@
#include "Poco/BasicEvent.h"
#include "Poco/Delegate.h"
#include "Poco/Debugger.h"
#include "Poco/Exception.h"
#include <iostream>
#include <sstream>
#include <vector>
@ -209,38 +208,48 @@ void CoreTest::testEnvironment()
void CoreTest::testBuffer()
{
std::size_t s = 10;
std::size_t const s = 10;
Buffer<int> b(s);
assertTrue (b.size() == s);
assertTrue (b.sizeBytes() == s * sizeof(int));
assertTrue (b.capacity() == s);
assertTrue (b.capacityBytes() == s * sizeof(int));
std::vector<int> v;
for (int i = 0; i < s; ++i)
for (std::size_t i = 0; i < s; ++i)
{
v.push_back(i);
}
std::memcpy(b.begin(), &v[0], sizeof(int) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(int) * v.size());
assertTrue (s == b.size());
for (int i = 0; i < s; ++i)
assertTrue (b[i] == i);
for (std::size_t i = 0; i < s; ++i)
{
assertTrue (b[i] == static_cast<int>(i));
}
b.resize(s/2);
for (int i = 0; i < s/2; ++i)
assertTrue (b[i] == i);
for (std::size_t i = 0; i < s/2; ++i)
{
assertTrue (b[i] == static_cast<int>(i));
}
assertTrue (b.size() == s/2);
assertTrue (b.capacity() == s);
b.resize(s*2);
v.clear();
for (int i = 0; i < s*2; ++i)
for (std::size_t i = 0; i < s*2; ++i)
{
v.push_back(i);
}
std::memcpy(b.begin(), &v[0], sizeof(int) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(int) * v.size());
for (int i = 0; i < s*2; ++i)
assertTrue (b[i] == i);
for (std::size_t i = 0; i < s*2; ++i)
{
assertTrue (b[i] == static_cast<int>(i));
}
assertTrue (b.size() == s*2);
assertTrue (b.capacity() == s*2);
@ -336,7 +345,7 @@ void CoreTest::testFIFOBufferEOFAndError()
for (T c = '0'; c < '0' + 10; ++c)
v.push_back(c);
std::memcpy(b.begin(), &v[0], sizeof(T) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(T) * v.size());
assertTrue (0 == _notToReadable);
assertTrue (0 == _readableToNot);
assertTrue (10 == f.write(b));
@ -442,7 +451,7 @@ void CoreTest::testFIFOBufferChar()
for (T c = '0'; c < '0' + 10; ++c)
v.push_back(c);
std::memcpy(b.begin(), &v[0], sizeof(T) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(T) * v.size());
assertTrue (0 == _notToReadable);
assertTrue (0 == _readableToNot);
f.write(b);
@ -480,7 +489,7 @@ void CoreTest::testFIFOBufferChar()
v.push_back(c);
b.resize(10);
std::memcpy(b.begin(), &v[0], sizeof(T) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(T) * v.size());
f.write(b);
assertTrue (20 == f.size());
assertTrue (15 == f.used());
@ -690,7 +699,7 @@ void CoreTest::testFIFOBufferChar()
assertTrue (1 == _notToWritable);
assertTrue (1 == _writableToNot);
const char arr[3] = {'4', '5', '6' };
const char arr[4] = {'4', '5', '6', '7' };
try
{
f.copy(&arr[0], 8);
@ -773,7 +782,7 @@ void CoreTest::testFIFOBufferInt()
for (T c = 0; c < 10; ++c)
v.push_back(c);
std::memcpy(b.begin(), &v[0], sizeof(T) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(T) * v.size());
f.write(b);
assertTrue (20 == f.size());
assertTrue (10 == f.used());
@ -807,7 +816,7 @@ void CoreTest::testFIFOBufferInt()
v.push_back(c);
b.resize(10);
std::memcpy(b.begin(), &v[0], sizeof(T) * v.size());
std::memcpy(b.begin(), v.data(), sizeof(T) * v.size());
f.write(b);
assertTrue (20 == f.size());
assertTrue (15 == f.used());

View File

@ -407,11 +407,11 @@ void DateTimeTest::testArithmetics()
Poco::LineNumber lineNum; // source line number
int year1; // operand/result date1 year
int month1; // operand/result date1 month
unsigned int day1; // operand/result date1 day
int day1; // operand/result date1 day
int numDays; // operand/result 'int' number of days
int year2; // operand/result date2 year
int month2; // operand/result date2 month
unsigned int day2; // operand/result date2 day
int day2; // operand/result date2 day
} data[] =
{
// - - - -first- - - - - - - second - - -
@ -476,10 +476,10 @@ void DateTimeTest::testIncrementDecrement()
int lineNum; // source line number
int year1; // (first) date year
int month1; // (first) date month
unsigned int day1; // (first) date day
int day1; // (first) date day
int year2; // (second) date year
int month2; // (second) date month
unsigned int day2; // (second) date day
int day2; // (second) date day
} data[] =
{
// - - - -first- - - - - - - second - - -

View File

@ -462,7 +462,7 @@ XMLStreamParser::EventType XMLStreamParser::nextBody()
_qualifiedName = &_qname;
break; // No more declarations.
}
// Fall through.
[[fallthrough]];
}
case EV_START_ELEMENT:
{
@ -507,7 +507,7 @@ XMLStreamParser::EventType XMLStreamParser::nextBody()
_pvalue = &_value;
break; // No more attributes.
}
// Fall through.
[[fallthrough]];
}
case EV_START_ELEMENT:
case EV_START_NAMESPACE_DECL:
@ -541,7 +541,7 @@ XMLStreamParser::EventType XMLStreamParser::nextBody()
_qualifiedName = &_qname;
break; // No more declarations.
}
// Fall through.
[[fallthrough]];
}
// The end namespace declaration comes before the end element
// which means it can follow pretty much any other event.

View File

@ -23,45 +23,57 @@
# - PocoXmtd.lib for /MT debug build
if(MSVC)
if(POCO_MT)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
if(POCO_MT)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE)
else(POCO_MT)
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(POCO_MT)
if(POCO_SANITIZE_ASAN)
message(WARNING "Use POCO_SANITIZEFLAGS instead of POCO_SANITIZE_ASAN")
add_compile_options("/fsanitize=address")
endif()
set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE)
else(POCO_MT)
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(POCO_MT)
else(MSVC)
# Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment
set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE)
# Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment
set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE)
endif(MSVC)
if (DEFINED POCO_SANITIZEFLAGS AND NOT "${POCO_SANITIZEFLAGS}" STREQUAL "")
message(STATUS "Using sanitize flags: ${POCO_SANITIZEFLAGS}")
add_compile_options(${POCO_SANITIZEFLAGS})
add_link_options(${POCO_SANITIZEFLAGS})
endif()
if (ENABLE_COMPILER_WARNINGS)
message(STATUS "Enabling additional compiler warning flags.")
# Additional compiler-specific warning flags
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using clang
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++
add_compile_options(/W4)
endif()
message(STATUS "Enabling additional compiler warning flags.")
# Additional compiler-specific warning flags
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using clang
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++
add_compile_options(/W4)
endif()
endif()
# Add a d postfix to the debug libraries