@@ -1,5 +1,11 @@
2013-10-21 David Malcolm <dmalcolm@redhat.com>
+ * libgccjit.c (gcc_jit_function_new_local): Use a more clear
+ error message for the case where someone tries to add a local
+ to a function imported from elsewhere.
+
+2013-10-21 David Malcolm <dmalcolm@redhat.com>
+
* TODO.rst ("the C unary prefix "&" operator"): Remove completed item.
* internal-api.c (gcc::jit::lvalue::get_address): New.
* internal-api.h (gcc::jit::lvalue::get_address): New.
@@ -544,7 +544,10 @@ gcc_jit_function_new_local (gcc_jit_function *func,
gcc_jit_type *type,
const char *name)
{
- RETURN_NULL_IF_NOT_FUNC_DEFINITION (func);
+ RETURN_NULL_IF_FAIL (func, NULL, "NULL function");
+ RETURN_NULL_IF_FAIL (func->get_kind () != GCC_JIT_FUNCTION_IMPORTED,
+ NULL,
+ "Cannot add locals to an imported function");
RETURN_NULL_IF_FAIL (type, NULL, "NULL type");
RETURN_NULL_IF_FAIL (name, NULL, "NULL name");