Skip to content

path.cpp: fixed -Wuseless-cast GCC warning with C++17#7771

Merged
firewave merged 1 commit intodanmar:mainfrom
firewave:path-cast
Aug 28, 2025
Merged

path.cpp: fixed -Wuseless-cast GCC warning with C++17#7771
firewave merged 1 commit intodanmar:mainfrom
firewave:path-cast

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

building with the GUI enabled will implicitly switch the standard to C++17.

/home/runner/work/cppcheck/cppcheck/lib/path.cpp: In function ‘bool hasEmacsCppMarker(const char*)’:
/home/runner/work/cppcheck/cppcheck/lib/path.cpp:246:40: error: useless cast to type ‘char*’ [-Werror=useless-cast]
  246 |         const char * const res = fgets(const_cast<char*>(buf.data()), buf.size(), fp);
      |

building with the GUI enabled will implicitly switch the standard to C++17.

```
/home/runner/work/cppcheck/cppcheck/lib/path.cpp: In function ‘bool hasEmacsCppMarker(const char*)’:
/home/runner/work/cppcheck/cppcheck/lib/path.cpp:246:40: error: useless cast to type ‘char*’ [-Werror=useless-cast]
  246 |         const char * const res = fgets(const_cast<char*>(buf.data()), buf.size(), fp);
      |
```
@sonarqubecloud
Copy link
Copy Markdown

Comment thread lib/path.cpp Dismissed
@firewave firewave merged commit b413181 into danmar:main Aug 28, 2025
63 checks passed
@firewave firewave deleted the path-cast branch August 28, 2025 15:38
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.

3 participants