Support building mbed_critical.c with C++ compiler #3305
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.
Description
Some developers prefer using a C++ compiler with C sources due to stricter syntax checking and other benefits. Currently mbed_critical.c is the only C source file in the mbed base library that does not build properly with a C++ compiler due to use of UINT32_MAX on an assertion. This change declares __STDC_LIMIT_MACROS on mbed_critical.c before the include of critical.h so the standard C limit macros are defined in stdint.h.
Status
READY
Related PRs
Discussed in #3276 and proposal by @0xc0170 selected for this PR
__STDC_LIMIT_MACROS declaration previously added in #1920 and removed in #2054