◐ Shell
reader mode source ↗
Skip to content

clang-tidy.yml: updated to Clang 21#421

Merged
firewave merged 8 commits into
cppcheck-opensource:masterfrom
firewave:clang-21
Sep 29, 2025
Merged

clang-tidy.yml: updated to Clang 21#421
firewave merged 8 commits into
cppcheck-opensource:masterfrom
firewave:clang-21

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@firewave

firewave commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator Author
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_pair.h:295:17: error: an exception may be thrown in function 'pair' which should not throw exceptions [bugprone-exception-escape,-warnings-as-errors]
  295 |       constexpr pair(pair&&) = default;         ///< Move constructor
      |                 ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1754:29: note: frame #0: unhandled exception of type 'simplecpp::Macro::Error' may be thrown in function 'parseDefine' here
 1754 |                             throw Error(tok->location, "In definition of '" + nameTokDef->str() + "': Missing opening parenthesis for __VA_OPT__");
      |                             ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1515:21: note: frame #1: function 'operator=' calls function 'parseDefine' here
 1515 |                     parseDefine(other.nameTokDef);
      |                     ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1502:19: note: frame #2: function 'Macro' calls function 'operator=' here
 1502 |             *this = other;
      |                   ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_pair.h:295:17: note: frame #3: function 'pair' calls function 'Macro' here
  295 |       constexpr pair(pair&&) = default;         ///< Move constructor
      |                 ^

@glankk this was introduced in 8f8bfe3 - please have a look

@glankk

glankk commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

@glankk this was introduced in 8f8bfe3 - please have a look

The root cause of this issue seems to be that Macro doesn't have a move constructor, so its copy constructor is used instead in the std::pair move constructor. The default move constructor in Macro is deleted because it has a reference as a member (which I think is generally a bad idea).

I think the cleanest solution to this is to replace the references with pointers and implement sane move operators. I'll work out a draft. @danmar please chime in if you have an opinion on this.

@glankk

glankk commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Related: #493

@firewave

firewave commented Sep 8, 2025

Copy link
Copy Markdown
Collaborator Author

I filed https://trac.cppcheck.net/ticket/14119 about detecting one of the misc-const-correctness cases ourselves.

@firewave

firewave commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator Author

I worked around the bugprone-exception-escape warning for now and filed #537.

@firewave firewave marked this pull request as ready for review September 9, 2025 10:29
@chrchr-github

Copy link
Copy Markdown
Contributor

Can this be merged? It is blocking cppcheck-opensource/cppcheck#7807

@chrchr-github

Copy link
Copy Markdown
Contributor

Ping @danmar

@firewave

Copy link
Copy Markdown
Collaborator Author

I validated the misc-const-correctness changes with #548 and the suppressions removed.

@danmar danmar 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.

Hide comment

I just have spelling to complain about

Hide details View details @firewave firewave merged commit d86671f into cppcheck-opensource:master Sep 29, 2025
16 checks passed
@firewave firewave deleted the clang-21 branch September 29, 2025 00:35
@chrchr-github

Copy link
Copy Markdown
Contributor

Are there any plans for a new simplecpp version?

@firewave

Copy link
Copy Markdown
Collaborator Author

Are there any plans for a new simplecpp version?

From my side after #475 was merged.

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.

4 participants