Page MenuHomeFreeBSD

Fix makefs bootstrap on macOS after D25563
ClosedPublic

Authored by arichardson on Aug 3 2020, 2:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 7:30 PM
Unknown Object (File)
Sat, Nov 23, 7:59 AM
Unknown Object (File)
Fri, Nov 22, 10:28 AM
Unknown Object (File)
Thu, Nov 21, 7:13 AM
Unknown Object (File)
Wed, Nov 20, 12:32 AM
Unknown Object (File)
Mon, Nov 11, 11:09 AM
Unknown Object (File)
Tue, Nov 5, 7:30 AM
Unknown Object (File)
Sat, Nov 2, 4:10 PM
Subscribers

Details

Summary

The macOS assert.h header does not define static_assert when compiling in
C99 mode. To fix this compile with -std=c11.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33138
Build 30497: arc lint + arc unit

Event Timeline

arichardson created this revision.

I'm not sure but if I'm reading it right:

#ifndef __cplusplus
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define static_assert _Static_assert
#endif /* __STDC_VERSION__ */
#endif /* !__cplusplus */

It's basically saying, if we are not compiling for C++ and if -std=c11 was used, static_assert is defined as an alias of _Static_assert? Will saying CSTD=c11 fix this on macOS?

I'm not sure but if I'm reading it right:

#ifndef __cplusplus
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define static_assert _Static_assert
#endif /* __STDC_VERSION__ */
#endif /* !__cplusplus */

It's basically saying, if we are not compiling for C++ and if -std=c11 was used, static_assert is defined as an alias of _Static_assert? Will saying CSTD=c11 fix this on macOS?

Yeah using C11 should also fix it since C11 requires assert.h to define static_assert.

emaste added a subscriber: emaste.

I'd slightly prefer compiling as C11 and spelling it the sensible (static_assert) way, but either way is acceptable to me.

This revision is now accepted and ready to land.Aug 21 2020, 11:40 PM
This revision now requires review to proceed.Aug 24 2020, 10:05 AM

As an aside, we should put CSTD in style.Makefile(5). Looking at a few other examples this order seems to be common -- WARNS, CSTD, CFLAGS

This revision is now accepted and ready to land.Aug 24 2020, 12:45 PM

As an aside, we should put CSTD in style.Makefile(5). Looking at a few other examples this order seems to be common -- WARNS, CSTD, CFLAGS

I searched for CSTD and it seems most uses are after WARNS, so I did the same here. I wasn't aware of style.Makefile(5) but if you'd like I can add CSTD between warns and CFLAGS?

I searched for CSTD and it seems most uses are after WARNS, so I did the same here. I wasn't aware of style.Makefile(5) but if you'd like I can add CSTD between warns and CFLAGS?

Sure, I think it'd be fine to make that change to style.Makefile.

This revision was automatically updated to reflect the committed changes.