aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-29 14:01:12 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-29 14:01:12 -0500
commit1c60f3145098cda92a7bd90ed0fce4bd75a03d1c (patch)
tree11e9bf1b797e217169f2d2d4d3e3fa8bfa151571 /src/ir.cpp
parent2b5e0b66a27d2a83cb596a28c9792a86523401b3 (diff)
downloadzig-1c60f3145098cda92a7bd90ed0fce4bd75a03d1c.tar.gz
zig-1c60f3145098cda92a7bd90ed0fce4bd75a03d1c.zip
add compile error for calling naked function
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index c8afd27945..f76ed753d5 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -9837,6 +9837,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
AstNode *fn_proto_node = fn_entry ? fn_entry->proto_node : nullptr;;
+ if (fn_type_id->cc == CallingConventionNaked) {
+ ErrorMsg *msg = ir_add_error(ira, fn_ref, buf_sprintf("unable to call function with naked calling convention"));
+ if (fn_proto_node) {
+ add_error_note(ira->codegen, msg, fn_proto_node, buf_sprintf("declared here"));
+ }
+ return ira->codegen->builtin_types.entry_invalid;
+ }
+
+
if (fn_type_id->is_var_args) {
if (call_param_count < src_param_count) {
ErrorMsg *msg = ir_add_error_node(ira, source_node,