Skip to content

BUILD_ASSERT doesn't work outside gcc #8160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andyross opened this issue Jun 4, 2018 · 2 comments
Closed

BUILD_ASSERT doesn't work outside gcc #8160

andyross opened this issue Jun 4, 2018 · 2 comments
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@andyross
Copy link
Collaborator

andyross commented Jun 4, 2018

As discovered in #8093, our generic implementation of BUILD_ASSERT produces preprocessor errors always, not just when the assertion case is failing.

We don't actually use this on any platforms that don't already support C11's _Static_assert(), so this is fairly low priority. But someone should look at it at some point.

@nashif nashif added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Jun 4, 2018
@andyross
Copy link
Collaborator Author

andyross commented Mar 5, 2019

Closing this one. We have toolchain support for this already in non-gcc toolchains, and no gcc ones known are going to hit the "no _Static_assert() available" case anyway.

@andyross andyross closed this as completed Mar 5, 2019
@rgundi
Copy link
Contributor

rgundi commented Mar 5, 2019

@andyross XCC currently doesn't have _Static_assert() defined, but the generic BUILD_ASSERT defined in include/toolchain/common.h works just fine. I see that the error like below is generated only when the assertion case is failing.
warning: division by zero
error: enumerator value for ‘__build_assert15’ is not an integer constant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants