Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cppcheck 2.13 on Ubuntu 24.04 leads to constParameterCallback on pre-commit hook #16

Closed
blueskyson opened this issue Jul 22, 2024 · 3 comments · Fixed by #17
Closed

Comments

@blueskyson
Copy link
Contributor

Environment

  • Cppcheck Version: 2.13
  • Operating System: Ubuntu 24.04
  • Linux Version: Linux aspire7 6.8.0-38-generic #38-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:25:01 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

How to Reproduce

The following output shows up after adding changes and executing the git commit:

fibdrv.c:75:33: style: Parameter 'offset' can be declared as pointer to const. However it seems that 'fib_read' is a callback function, if 'offset' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
                        loff_t *offset)
                                ^
fibdrv.c:114:13: note: You might need to cast the function pointer here
    .read = fib_read,
            ^
fibdrv.c:75:33: note: Parameter 'offset' can be declared as pointer to const
                        loff_t *offset)
                                ^
nofile:0:0: information: Active checkers: 106/592 (use --checkers-report=<filename> to see details) [checkersReport]

Fail to pass static analysis.

Proposed Solution

Add --suppress=constParameterCallback:fibdrv.c to the Cppcheck commandline options.

@jserv
Copy link
Contributor

jserv commented Jul 23, 2024

Proposed Solution
Add --suppress=constParameterCallback:fibdrv.c to the Cppcheck commandline options.

It sounds great. Send a pull request.

@blueskyson
Copy link
Contributor Author

How about adding the Ubuntu 24.04 environment to the GitHub Action workflow?

@jserv jserv closed this as completed in #17 Jul 23, 2024
@jserv
Copy link
Contributor

jserv commented Jul 23, 2024

How about adding the Ubuntu 24.04 environment to the GitHub Action workflow?

Good idea. Please proceed.

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 a pull request may close this issue.

2 participants