Fix strict C11 compilation of mjsan.h - #3514
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the AddressSanitizer stack instrumentation in
mjsan.hcompile under GCC's strict C11 mode.The sanitizer-only definitions currently use two constructs rejected by the project's
-std=c11 -Wpedantic -Werrorconfiguration:asm, which is not a C11 keyword__attribute__((always_inline))after the declarator on a function definition, which GCC rejectsThis moves
always_inlinebefore the definition and uses__asm__ volatilefor the memory barriers. The generated semantics are unchanged, and the non-sanitizer path is untouched.This revives the still-relevant fix from closed, unmerged PR #3458 by @teerthsharma, rebased onto current
main.Validation
Focused GCC 14.2.0 compile passed:
cc -std=c11 -Wpedantic -Werror -fsanitize=address -c <minimal translation unit including mjsan.h>Final diff: one file, six line substitutions, one commit.
A full MuJoCo sanitizer build was not run in this environment.