diff --git a/doc/langref.md b/doc/langref.md index dc1a998eae..ebcda01e4e 100644 --- a/doc/langref.md +++ b/doc/langref.md @@ -149,7 +149,7 @@ GotoExpression = option("inline") "goto" Symbol GroupedExpression = "(" Expression ")" -KeywordLiteral = "true" | "false" | "null" | "break" | "continue" | "undefined" | "zeroes" | "error" | "type" | "this" +KeywordLiteral = "true" | "false" | "null" | "break" | "continue" | "undefined" | "error" | "type" | "this" ContainerDecl = option("extern") ("struct" | "enum" | "union") "{" many(StructMember) "}" diff --git a/src/all_types.hpp b/src/all_types.hpp index e9c2118f68..60e22f49f1 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -126,7 +126,6 @@ enum ConstValSpecial { ConstValSpecialRuntime, ConstValSpecialStatic, ConstValSpecialUndef, - ConstValSpecialZeroes, }; enum RuntimeHintErrorUnion { @@ -271,7 +270,6 @@ enum NodeType { NodeTypeBoolLiteral, NodeTypeNullLiteral, NodeTypeUndefinedLiteral, - NodeTypeZeroesLiteral, NodeTypeThisLiteral, NodeTypeIfBoolExpr, NodeTypeIfVarExpr, @@ -655,9 +653,6 @@ struct AstNodeNullLiteral { struct AstNodeUndefinedLiteral { }; -struct AstNodeZeroesLiteral { -}; - struct AstNodeThisLiteral { }; @@ -737,7 +732,6 @@ struct AstNode { AstNodeStructValueField struct_val_field; AstNodeNullLiteral null_literal; AstNodeUndefinedLiteral undefined_literal; - AstNodeZeroesLiteral zeroes_literal; AstNodeThisLiteral this_literal; AstNodeSymbolExpr symbol_expr; AstNodeBoolLiteral bool_literal; diff --git a/src/analyze.cpp b/src/analyze.cpp index e78dea22aa..979d6336cf 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -60,7 +60,6 @@ AstNode *first_executing_node(AstNode *node) { case NodeTypeBoolLiteral: case NodeTypeNullLiteral: case NodeTypeUndefinedLiteral: - case NodeTypeZeroesLiteral: case NodeTypeThisLiteral: case NodeTypeIfBoolExpr: case NodeTypeIfVarExpr: @@ -1793,7 +1792,6 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) { case NodeTypeBoolLiteral: case NodeTypeNullLiteral: case NodeTypeUndefinedLiteral: - case NodeTypeZeroesLiteral: case NodeTypeThisLiteral: case NodeTypeSymbol: case NodeTypePrefixOpExpr: @@ -3403,9 +3401,6 @@ void render_const_value(Buf *buf, ConstExprValue *const_val) { case ConstValSpecialUndef: buf_appendf(buf, "undefined"); return; - case ConstValSpecialZeroes: - buf_appendf(buf, "zeroes"); - return; case ConstValSpecialStatic: break; } diff --git a/src/ast_render.cpp b/src/ast_render.cpp index 2b5eb7f890..655570716e 100644 --- a/src/ast_render.cpp +++ b/src/ast_render.cpp @@ -177,8 +177,6 @@ static const char *node_type_str(NodeType node_type) { return "NullLiteral"; case NodeTypeUndefinedLiteral: return "UndefinedLiteral"; - case NodeTypeZeroesLiteral: - return "ZeroesLiteral"; case NodeTypeThisLiteral: return "ThisLiteral"; case NodeTypeIfBoolExpr: @@ -877,7 +875,6 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { case NodeTypeErrorValueDecl: case NodeTypeStructField: case NodeTypeUse: - case NodeTypeZeroesLiteral: zig_panic("TODO more ast rendering"); } } diff --git a/src/codegen.cpp b/src/codegen.cpp index 35039b9418..b068042ced 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1244,13 +1244,10 @@ static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable, IrInstruction *init_value = decl_var_instruction->init_value; bool have_init_expr = false; - bool want_zeroes = false; ConstExprValue *const_val = &init_value->value; if (const_val->special == ConstValSpecialRuntime || const_val->special == ConstValSpecialStatic) have_init_expr = true; - if (const_val->special == ConstValSpecialZeroes) - want_zeroes = true; if (have_init_expr) { assert(var->value.type == init_value->value.type); @@ -1259,14 +1256,14 @@ static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable, bool ignore_uninit = false; // handle runtime stack allocation bool want_safe = ir_want_debug_safety(g, &decl_var_instruction->base); - if (!ignore_uninit && (want_safe || want_zeroes)) { + if (!ignore_uninit && want_safe) { TypeTableEntry *usize = g->builtin_types.entry_usize; uint64_t size_bytes = LLVMStoreSizeOfType(g->target_data_ref, var->value.type->type_ref); uint64_t align_bytes = get_memcpy_align(g, var->value.type); // memset uninitialized memory to 0xa LLVMTypeRef ptr_u8 = LLVMPointerType(LLVMInt8Type(), 0); - LLVMValueRef fill_char = LLVMConstInt(LLVMInt8Type(), want_zeroes ? 0x00 : 0xaa, false); + LLVMValueRef fill_char = LLVMConstInt(LLVMInt8Type(), 0xaa, false); LLVMValueRef dest_ptr = LLVMBuildBitCast(g->builder, var->value_ref, ptr_u8, ""); LLVMValueRef byte_count = LLVMConstInt(usize->type_ref, size_bytes, false); LLVMValueRef align_in_bytes = LLVMConstInt(LLVMInt32Type(), align_bytes, false); @@ -2440,8 +2437,6 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) { zig_unreachable(); case ConstValSpecialUndef: return LLVMGetUndef(canon_type->type_ref); - case ConstValSpecialZeroes: - return LLVMConstNull(canon_type->type_ref); case ConstValSpecialStatic: break; diff --git a/src/ir.cpp b/src/ir.cpp index 1103aa697a..e422545473 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -5223,8 +5223,6 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop zig_panic("TODO IR gen NodeTypeErrorValueDecl"); case NodeTypeTypeDecl: zig_panic("TODO IR gen NodeTypeTypeDecl"); - case NodeTypeZeroesLiteral: - zig_panic("TODO zeroes is deprecated"); } zig_unreachable(); } @@ -5930,9 +5928,6 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un ir_add_error(ira, value, buf_sprintf("use of undefined value")); return nullptr; } - case ConstValSpecialZeroes: - ir_add_error(ira, value, buf_sprintf("zeroes is deprecated")); - return nullptr; } zig_unreachable(); } diff --git a/src/parser.cpp b/src/parser.cpp index 6b602c122f..b0f909dc5d 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -622,7 +622,7 @@ static AstNode *ast_parse_goto_expr(ParseContext *pc, size_t *token_index, bool } /* PrimaryExpression = Number | String | CharLiteral | KeywordLiteral | GroupedExpression | GotoExpression | BlockExpression | Symbol | ("@" Symbol FnCallExpression) | ArrayType | (option("extern") FnProto) | AsmExpression | ("error" "." Symbol) | ContainerDecl -KeywordLiteral = "true" | "false" | "null" | "break" | "continue" | "undefined" | "zeroes" | "error" | "type" | "this" +KeywordLiteral = "true" | "false" | "null" | "break" | "continue" | "undefined" | "error" | "type" | "this" */ static AstNode *ast_parse_primary_expr(ParseContext *pc, size_t *token_index, bool mandatory) { Token *token = &pc->tokens->at(*token_index); @@ -670,10 +670,6 @@ static AstNode *ast_parse_primary_expr(ParseContext *pc, size_t *token_index, bo AstNode *node = ast_create_node(pc, NodeTypeUndefinedLiteral, token); *token_index += 1; return node; - } else if (token->id == TokenIdKeywordZeroes) { - AstNode *node = ast_create_node(pc, NodeTypeZeroesLiteral, token); - *token_index += 1; - return node; } else if (token->id == TokenIdKeywordThis) { AstNode *node = ast_create_node(pc, NodeTypeThisLiteral, token); *token_index += 1; @@ -2585,9 +2581,6 @@ void ast_visit_node_children(AstNode *node, void (*visit)(AstNode **, void *cont case NodeTypeUndefinedLiteral: // none break; - case NodeTypeZeroesLiteral: - // none - break; case NodeTypeThisLiteral: // none break; diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 3af876d074..d2642c074c 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -140,7 +140,6 @@ static const struct ZigKeyword zig_keywords[] = { {"var", TokenIdKeywordVar}, {"volatile", TokenIdKeywordVolatile}, {"while", TokenIdKeywordWhile}, - {"zeroes", TokenIdKeywordZeroes}, }; bool is_zig_keyword(Buf *buf) { @@ -1472,7 +1471,6 @@ const char * token_name(TokenId id) { case TokenIdKeywordNoAlias: return "noalias"; case TokenIdKeywordSwitch: return "switch"; case TokenIdKeywordUndefined: return "undefined"; - case TokenIdKeywordZeroes: return "zeroes"; case TokenIdKeywordThis: return "this"; case TokenIdKeywordError: return "error"; case TokenIdKeywordType: return "type"; diff --git a/src/tokenizer.hpp b/src/tokenizer.hpp index 48f41b6ea7..4f3b7fad7a 100644 --- a/src/tokenizer.hpp +++ b/src/tokenizer.hpp @@ -40,7 +40,6 @@ enum TokenId { TokenIdKeywordNoAlias, TokenIdKeywordSwitch, TokenIdKeywordUndefined, - TokenIdKeywordZeroes, TokenIdKeywordError, TokenIdKeywordType, TokenIdKeywordInline,