Make threading macros follow C syntax #13960
Merged
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.
So that it doesn't confuse people reading the code or mess with editor formatting.
Require semicolon after
JL_(UN)LOCK.Make
FOR_*_HEAPmacros (use and) behave likeforloops.FOR_CURRENT_HEAPis because GCC and Clang cannot figure out (before optimization) that the loop body (with a singlereturn) is always executed and give a warning about not returning a value when reaching the end of the function.FOR_*_HEAPmacros are changed to function form to match C control flow syntax and possibly help editors to understand that it's not a type declaration. It doesn't really affect formatting and can be removed if people hate it.....@tkelman Someone claimed that the for loop trick might not work with MSVC. I guess it's due to declaration of an anonymous
structin the for loopor because MSVC doesn't support this C99 feature in C mode(edit: not for this reason, the example in that thread was also C++). I think this patch should be fine since thestructis declared outside the loopand we are compiling with C++. Could you please verify?