Skip to content

mitigated -Wunused-function Clang warnings with code added by matchcompiler#7810

Merged
firewave merged 1 commit intodanmar:mainfrom
firewave:mc-unused-x
Sep 25, 2025
Merged

mitigated -Wunused-function Clang warnings with code added by matchcompiler#7810
firewave merged 1 commit intodanmar:mainfrom
firewave:mc-unused-x

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Sep 9, 2025

/home/user/CLionProjects/cppcheck/cmake-build-relwithdebinfo-clang/lib/build/mc_checkinternal.cpp:7:20: warning: unused function 'match1' [-Wunused-function]
    7 | static inline bool match1(const Token* tok) {
      |                    ^~~~~~

…compiler

```
/home/user/CLionProjects/cppcheck/cmake-build-relwithdebinfo-clang/lib/build/mc_checkinternal.cpp:7:20: warning: unused function 'match1' [-Wunused-function]
    7 | static inline bool match1(const Token* tok) {
      |                    ^~~~~~
```
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Sep 9, 2025

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Sep 9, 2025

Using __attribute__((unused)) causes a warning about the functions marked as unused actually being used.

@danmar
Copy link
Copy Markdown
Owner

danmar commented Sep 10, 2025

Using attribute((unused)) causes a warning about the functions marked as unused actually being used.

so we are damned if we use it and damned if we don't.. it's not preferable to use it then is it?

@firewave
Copy link
Copy Markdown
Collaborator Author

so we are damned if we use it and damned if we don't.. it's not preferable to use it then is it?

Not at all since I went for the standards attribute. So if we ever switch to C++17 we can just enable this unconditionally - and use the UNUSED from config.h. Also it is "just" matchcompiled code so nobody ever needs to deal with it except for the compiler.

@firewave firewave merged commit 99cf9e3 into danmar:main Sep 25, 2025
63 of 64 checks passed
@firewave firewave deleted the mc-unused-x branch September 25, 2025 06:21
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.

2 participants