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

Silence -Wcast-qual warnings showing up with newer version of g++. #87

Merged
merged 1 commit into from
May 19, 2024

Conversation

hporten
Copy link
Contributor

@hporten hporten commented May 14, 2024

Somewhen between gcc 11 and a 14 pre-release, g++ started to complain about the C-style casts:

subprocess.h: In function ‘int subprocess_create_ex(const char* const*, int, const char* const*, subprocess_s*)’: subprocess.h:877:27: warning: cast from type ‘const char* const*’ to type ‘char* const*’ casts away qualifiers [-Wcast-qual]
877 | (char *const *)commandLine, used_environment)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~

The pragmas for clang should not be needed anymore.

Somewhen between gcc 11 and a 14 pre-release, g++ started to complain
about the C-style casts:

subprocess.h: In function ‘int subprocess_create_ex(const char* const*, int, const char* const*, subprocess_s*)’:
subprocess.h:877:27: warning: cast from type ‘const char* const*’ to type ‘char* const*’ casts away qualifiers [-Wcast-qual]
  877 |                           (char *const *)commandLine, used_environment)) {
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~

When compiling with GCC in C-mode, the issue is still there btw. The
pragmas existing for clang are needed for GCC as well.
@hporten
Copy link
Contributor Author

hporten commented May 14, 2024

Redid the first version after the CI system revealed: the pragmas were needed after all.

@sheredom
Copy link
Owner

I might tidy that up later and put them into the const cast itself as pragmas - might be a little neater! But LGTM, will merge once green.

@sheredom sheredom merged commit e84bb38 into sheredom:master May 19, 2024
29 checks passed
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.

None yet

2 participants