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)
Mon, Nov 11, 11:09 AM
Unknown Object (File)
Tue, Nov 5, 7:30 AM
Unknown Object (File)
Sat, Nov 2, 4:10 PM
Unknown Object (File)
Thu, Oct 24, 7:48 PM
Unknown Object (File)
Oct 16 2024, 3:21 PM
Unknown Object (File)
Oct 15 2024, 10:12 AM
Unknown Object (File)
Oct 15 2024, 10:12 AM
Unknown Object (File)
Oct 14 2024, 2: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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.