Skip to content

Commit a7b298f

Browse files
committed
mstd_cstddef: add C support and macros for C++11
1 parent 3d719f7 commit a7b298f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

platform/cxxsupport/mstd_cstddef

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@
2727
* - - MSTD_CONSTEXPR_XX_14 macros that can be used to mark
2828
* things that are valid as constexpr only for C++14 or later,
2929
* permitting constexpr use where ARM C 5 would reject it.
30+
* - - MSTD_CONSTEXPR_XX_11 macros that can be used to permit
31+
* constexpr alternatives for C.
3032
*/
3133

34+
#if __cplusplus
35+
3236
#include <cstddef>
3337

3438
/* Macros that can be used to mark functions and objects that are
@@ -42,6 +46,9 @@
4246
#define MSTD_CONSTEXPR_OBJ_14 const
4347
#endif
4448

49+
#define MSTD_CONSTEXPR_FN_11 constexpr
50+
#define MSTD_CONSTEXPR_OBJ_11 constexpr
51+
4552
#ifdef __CC_ARM
4653

4754
// [expr.alignof]
@@ -72,4 +79,13 @@ using std::max_align_t;
7279

7380
}
7481

82+
#else // __cplusplus
83+
84+
#define MSTD_CONSTEXPR_FN_14 inline
85+
#define MSTD_CONSTEXPR_OBJ_14 const
86+
#define MSTD_CONSTEXPR_FN_11 inline
87+
#define MSTD_CONSTEXPR_OBJ_11 const
88+
89+
#endif // __cplusplus
90+
7591
#endif // MSTD_CSTDDEF_

0 commit comments

Comments
 (0)