mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-09 04:51:37 -07:00
Remove @(warning) and #warning(...)
This commit is contained in:
@@ -1438,7 +1438,7 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
|
||||
case: error(p, stmt.pos, "#partial can only be applied to a switch statement")
|
||||
}
|
||||
return stmt
|
||||
case "assert", "panic", "warning":
|
||||
case "assert", "panic":
|
||||
bd := ast.new(ast.Basic_Directive, tok.pos, end_pos(tag))
|
||||
bd.tok = tok
|
||||
bd.name = name
|
||||
|
||||
@@ -1714,26 +1714,6 @@ gb_internal bool check_builtin_procedure_directive(CheckerContext *c, Operand *o
|
||||
|
||||
operand->type = t_untyped_bool;
|
||||
operand->mode = Addressing_Constant;
|
||||
} else if (name == "warning") {
|
||||
ERROR_BLOCK();
|
||||
if (ce->args.count != 1) {
|
||||
error(call, "'#warning' expects 1 argument, got %td", ce->args.count);
|
||||
return false;
|
||||
}
|
||||
if (!is_type_string(operand->type) && operand->mode != Addressing_Constant) {
|
||||
gbString str = expr_to_string(ce->args[0]);
|
||||
error(call, "'%s' is not a constant string", str);
|
||||
gb_string_free(str);
|
||||
return false;
|
||||
}
|
||||
warning(call, "%.*s", LIT(operand->value.value_string));
|
||||
if (c->proc_name != "") {
|
||||
gbString str = type_to_string(c->curr_proc_sig);
|
||||
error_line("\tCalled within '%.*s' :: %s\n", LIT(c->proc_name), str);
|
||||
gb_string_free(str);
|
||||
}
|
||||
operand->type = t_invalid;
|
||||
operand->mode = Addressing_NoValue;
|
||||
} else if (name == "panic") {
|
||||
ERROR_BLOCK();
|
||||
if (ce->args.count != 1) {
|
||||
|
||||
@@ -3493,20 +3493,6 @@ gb_internal DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
|
||||
error(elem, "Expected a string value for '%.*s'", LIT(name));
|
||||
}
|
||||
return true;
|
||||
} else if (name == "warning") {
|
||||
ExactValue ev = check_decl_attribute_value(c, value);
|
||||
|
||||
if (ev.kind == ExactValue_String) {
|
||||
String msg = ev.value_string;
|
||||
if (msg.len == 0) {
|
||||
error(elem, "Warning message cannot be an empty string");
|
||||
} else {
|
||||
ac->warning_message = msg;
|
||||
}
|
||||
} else {
|
||||
error(elem, "Expected a string value for '%.*s'", LIT(name));
|
||||
}
|
||||
return true;
|
||||
} else if (name == "require_results") {
|
||||
if (value != nullptr) {
|
||||
error(elem, "Expected no value for '%.*s'", LIT(name));
|
||||
|
||||
+1
-1
@@ -5167,7 +5167,7 @@ gb_internal Ast *parse_stmt(AstFile *f) {
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
} else if (tag == "assert" || tag == "panic" || tag == "warning") {
|
||||
} else if (tag == "assert" || tag == "panic") {
|
||||
Ast *t = ast_basic_directive(f, hash_token, name);
|
||||
Ast *stmt = ast_expr_stmt(f, parse_call_expr(f, t));
|
||||
expect_semicolon(f);
|
||||
|
||||
Reference in New Issue
Block a user