From 3ca861c7dd048a8bc15b6776a3b56fdc790750f7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 25 Feb 2019 19:31:30 -0500 Subject: add a compile error note when C import fails and not linking libc closes #558 --- src/ir.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 929f195586..d6e40384f8 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -18705,6 +18705,10 @@ static IrInstruction *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruct if (errors.length > 0) { ErrorMsg *parent_err_msg = ir_add_error_node(ira, node, buf_sprintf("C import failed")); + if (ira->codegen->libc_link_lib == nullptr) { + add_error_note(ira->codegen, parent_err_msg, node, + buf_sprintf("libc headers not available; compilation does not link against libc")); + } for (size_t i = 0; i < errors.length; i += 1) { ErrorMsg *err_msg = errors.at(i); err_msg_add_note(parent_err_msg, err_msg); -- cgit v1.2.3