This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch silence_sonarcloud_warning in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 3b2cdc5bf6b0780609c39770c35e027fb3af98f9 Author: Stephen Webb <[email protected]> AuthorDate: Wed Jul 2 13:13:11 2025 +1000 Prevent SonarCloud warning --- .github/workflows/sonarcloud.yml | 6 +++--- src/main/include/log4cxx/helpers/singletonholder.h | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index afe89b75..535fce09 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -18,8 +18,8 @@ on: push: branches: - master -# pull_request: -# types: [opened, synchronize, reopened] + pull_request: + types: [opened, synchronize, reopened] jobs: build: @@ -94,6 +94,6 @@ jobs: # Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options args: > --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" - --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" + --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" --define sonar.coverageReportPaths=build/coverage.xml diff --git a/src/main/include/log4cxx/helpers/singletonholder.h b/src/main/include/log4cxx/helpers/singletonholder.h index e8b8ef23..2fefa8f1 100644 --- a/src/main/include/log4cxx/helpers/singletonholder.h +++ b/src/main/include/log4cxx/helpers/singletonholder.h @@ -44,13 +44,15 @@ public: // Object method stubs public: // ...structors SingletonHolder() {} - template <typename ... Args> + template <typename ... Args + , typename = std::enable_if_t<!std::is_same_v<std::decay_t<T>, SingletonHolder>> + > SingletonHolder(Args&& ... args) : m_data(std::forward<Args>(args) ... ) {} - // Prevent copying - SingletonHolder(const SingletonHolder&) = delete; - SingletonHolder(SingletonHolder&&) = delete; + // Prevent copying + SingletonHolder(const SingletonHolder&) = delete; + SingletonHolder(SingletonHolder&&) = delete; public: // Accessors T& value() { return m_data; }
