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)
Fri, Feb 23, 2:55 AM
Unknown Object (File)
Feb 17 2024, 4:44 AM
Unknown Object (File)
Jan 10 2024, 8:07 PM
Unknown Object (File)
Dec 10 2023, 6:42 PM
Unknown Object (File)
Nov 22 2023, 2:48 AM
Unknown Object (File)
Nov 10 2023, 2:01 PM
Unknown Object (File)
Nov 2 2023, 8:05 PM
Unknown Object (File)
Nov 2 2023, 8:05 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.