Skip to content

Fix #14850 (Compilation fails on oraclelinux:8 (g++ 8.5.0 released in 2021))#8654

Open
danmar wants to merge 10 commits into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-14850
Open

Fix #14850 (Compilation fails on oraclelinux:8 (g++ 8.5.0 released in 2021))#8654
danmar wants to merge 10 commits into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-14850

Conversation

@danmar

@danmar danmar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/settings.h Fixed

@firewave firewave left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a compiler bug to me.

We should make noexcept optional as a hack for this compiler in question instead of rolling back perfectly valid code.

@firewave

Copy link
Copy Markdown
Collaborator

See also https://trac.cppcheck.net/ticket/14851 to make sure such problems are not just platform-specific.

@danmar

danmar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

@firewave thanks for your review.. I also feel these errors are pretty weird. do you have some more specifiec suggestion how we hack it..

how about :

#ifdef GCC_BUG_HACK_NOEXCEPT
#define  NOEXCEPT
#else 
#define  NOEXCEPT  noexcept
#endif

And then I use NOEXCEPT in the constructor and assignment operator?

So when compiling on oraclelinux I will have to provide -DGCC_BUG_HACK_NOEXCEPT

Comment thread lib/settings.h Fixed
@danmar

danmar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

See also https://trac.cppcheck.net/ticket/14851 to make sure such problems are not just platform-specific.

testing more platforms/compilers sounds good to me. we can easily break stuff..

@firewave

Copy link
Copy Markdown
Collaborator

@firewave thanks for your review.. I also feel these errors are pretty weird. do you have some more specifiec suggestion how we hack it..

how about :

#ifdef GCC_BUG_HACK_NOEXCEPT
#define  NOEXCEPT
#else 
#define  NOEXCEPT  noexcept
#endif

And then I use NOEXCEPT in the constructor and assignment operator?

So when compiling on oraclelinux I will have to provide -DGCC_BUG_HACK_NOEXCEPT

Something along those lines. Using gcc -dM -E - < /dev/null you can check the compiler for some platform-specific defines.

@danmar

danmar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

Something along those lines. Using gcc -dM -E - < /dev/null you can check the compiler for some platform-specific defines.

I was not sure if it was a g++ 8.5.0 generic bug. Or what versions are affected.

but I now see that we can reproduce with godbolt also...

https://godbolt.org/z/YjGPdxsbK

@firewave

Copy link
Copy Markdown
Collaborator

I was not sure if it was a g++ 8.5.0 generic bug. Or what versions are affected.

but I now see that we can reproduce with godbolt also...

https://godbolt.org/z/YjGPdxsbK

That code appears to be invalid as it doesn't compile at all regardless of version or compiler.

@danmar

danmar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

That code appears to be invalid as it doesn't compile at all regardless of version or compiler.

yes .. and when I fix that then 8.5 doesn't complain anymore. :-(
I don't see how to reproduce on godbolt with a short code example unfortunately.
but I have also been able to reproduce the same issue on ubuntu:20.04 which uses g++ 9.4.0 compiler.

Comment thread lib/settings.h Fixed
Comment thread lib/settings.h Fixed
Comment thread lib/settings.h Fixed
@danmar

danmar commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@firewave ping could you please look? this blocks a cppcheck premium release as I can't build release binaries.

wjakobsson
wjakobsson previously approved these changes Jun 17, 2026
@danmar danmar requested a review from Copilot June 17, 2026 08:30
@firewave

Copy link
Copy Markdown
Collaborator

I have a system which has lots of old GCC versions installed and I wanted to give it a spin with it first but I won't until later today.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a GCC ≤9 (not Clang) compilation failure reported on Oracle Linux 8 by relaxing the noexcept specification for Settings move operations under affected compiler versions, and extends CI coverage to include an oraclelinux:8 container build. It also includes a small header formatting cleanup in lib/checks.h.

Changes:

  • Add a GCC-version-guarded workaround to omit noexcept on Settings move ctor/assignment for GCC ≤9.
  • Add oraclelinux:8 to the Docker-based Unix-ish CI matrix and install required build dependencies.
  • Minor namespace closing brace cleanup in lib/checks.h.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lib/settings.h Introduces the GCC workaround macro and applies it to Settings move operations.
lib/settings.cpp Applies the workaround macro to the defaulted move operations’ definitions.
lib/checks.h Removes an unnecessary trailing semicolon after a namespace block.
.github/workflows/CI-unixish-docker.yml Adds Oracle Linux 8 to CI and installs dependencies for that container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/settings.h
Comment thread lib/settings.h Outdated
Comment thread lib/settings.cpp Outdated
Comment thread .github/workflows/CI-unixish-docker.yml
@danmar

danmar commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

I have a system which has lots of old GCC versions installed and I wanted to give it a spin with it first but I won't until later today.

alright I will wait until later today.

Comment thread lib/settings.h Dismissed
Comment thread lib/settings.h

Settings(Settings&&) noexcept;
Settings& operator=(Settings&&) noexcept;
Settings(Settings&&) CPPCHECK_NOEXCEPT;
Comment thread lib/settings.h
Settings(Settings&&) noexcept;
Settings& operator=(Settings&&) noexcept;
Settings(Settings&&) CPPCHECK_NOEXCEPT;
Settings& operator=(Settings&&) CPPCHECK_NOEXCEPT;
Comment thread lib/settings.h
Settings(Settings&&) noexcept;
Settings& operator=(Settings&&) noexcept;
Settings(Settings&&) CPPCHECK_NOEXCEPT;
Settings& operator=(Settings&&) CPPCHECK_NOEXCEPT;
@firewave

Copy link
Copy Markdown
Collaborator

I have a system which has lots of old GCC versions installed and I wanted to give it a spin with it first but I won't until later today.

alright I will wait until later today.

Ugh. Won't happen that soon. Something in my main machine broke as it starts but I am only getting a black screen.

@firewave

Copy link
Copy Markdown
Collaborator

The graphics card was simply loose...

I was able to reproduce the issue with GCC 7 to 9 (no earlier version handy) and it is working with GCC 10 and up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants