implement allowzero pointer attribute

closes #1953

only needed for freestanding targets.

also adds safety for `@intToPtr` when the address is zero.
This commit is contained in:
Andrew Kelley
2019-03-25 12:55:45 -04:00
parent 3306e43984
commit 5eaead6a56
18 changed files with 225 additions and 78 deletions

View File

@@ -107,6 +107,7 @@ struct ZigKeyword {
static const struct ZigKeyword zig_keywords[] = {
{"align", TokenIdKeywordAlign},
{"allowzero", TokenIdKeywordAllowZero},
{"and", TokenIdKeywordAnd},
{"anyerror", TokenIdKeywordAnyerror},
{"asm", TokenIdKeywordAsm},
@@ -1495,6 +1496,7 @@ const char * token_name(TokenId id) {
case TokenIdIntLiteral: return "IntLiteral";
case TokenIdKeywordAsync: return "async";
case TokenIdKeywordAnyerror: return "anyerror";
case TokenIdKeywordAllowZero: return "allowzero";
case TokenIdKeywordAwait: return "await";
case TokenIdKeywordResume: return "resume";
case TokenIdKeywordSuspend: return "suspend";