Skip to content

Comments

Fix const qualifier error in engine_print.c for GCC 14+ compatibility#3102

Open
buresu wants to merge 1 commit intogoogle-deepmind:mainfrom
buresu:fix-linux-build
Open

Fix const qualifier error in engine_print.c for GCC 14+ compatibility#3102
buresu wants to merge 1 commit intogoogle-deepmind:mainfrom
buresu:fix-linux-build

Conversation

@buresu
Copy link

@buresu buresu commented Feb 15, 2026

Change 'c' variable to const char* to fix -Werror=discarded-qualifiers in validateFloatFormat function. GCC 14+ introduced stricter type checking defaults, flagging this assignment as an error.

This PR fixes

mujoco/src/engine/engine_print.c:484:12: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]  484 |   while (c = strchr(flag_characters, float_format[cur_idx]), c != NULL) {

Tested on

  • Linux: GCC 15.2.1 (x64)
  • Windows: MSVC 19.50.35723 (x64)
  • macOS: Apple Clang 17.0.0 (clang-1700.6.3.2) (arm64)

Change 'c' variable to const char* to fix -Werror=discarded-qualifiers in validateFloatFormat function.
GCC 14+ introduced stricter type checking defaults, flagging this assignment as an error.

(cherry picked from commit d832b6b)
@google-cla
Copy link

google-cla bot commented Feb 15, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant