diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-08 14:41:59 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-08 14:41:59 +0000 |
commit | e93a6f3001d1cda3f255a7c7c7ae6645934f0202 (patch) | |
tree | 3fbc08b75a6006db22d369b7360f24233a99c656 | |
parent | 60084b250051dded395ca14e7fc3e5c3ac521887 (diff) | |
download | gcc-e93a6f3001d1cda3f255a7c7c7ae6645934f0202.tar.gz |
PR jit/66783: improve error messages
gcc/jit/ChangeLog:
PR jit/66783
* libgccjit.c (gcc_jit_context_new_field): Show name of field in
"unknown size" error message.
(gcc_jit_struct_set_fields): Show name of struct in error message.
(gcc_jit_context_new_global): Show name of global in
"unknown size" error message.
(gcc_jit_function_new_local): Likewise for local.
gcc/testsuite/ChangeLog:
PR jit/66783
* jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c
(verify_code): Update expected error message.
* jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c
(verify_code): Likewise.
* jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c
(verify_code): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225557 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/jit/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/jit/libgccjit.c | 22 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c | 2 |
6 files changed, 38 insertions, 10 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 6fdcb604623..e9a32f0ae96 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,13 @@ +2015-07-08 David Malcolm <dmalcolm@redhat.com> + + PR jit/66783 + * libgccjit.c (gcc_jit_context_new_field): Show name of field in + "unknown size" error message. + (gcc_jit_struct_set_fields): Show name of struct in error message. + (gcc_jit_context_new_global): Show name of global in + "unknown size" error message. + (gcc_jit_function_new_local): Likewise for local. + 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Adjust includes. diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c index 85d9f62f041..eee513f05c8 100644 --- a/gcc/jit/libgccjit.c +++ b/gcc/jit/libgccjit.c @@ -543,10 +543,11 @@ gcc_jit_context_new_field (gcc_jit_context *ctxt, /* LOC can be NULL. */ RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF1 ( + RETURN_NULL_IF_FAIL_PRINTF2 ( type->has_known_size (), ctxt, loc, - "type has unknown size (type: %s)", + "unknown size for field \"%s\" (type: %s)", + name, type->get_debug_string ()); return (gcc_jit_field *)ctxt->new_field (loc, type, name); @@ -662,7 +663,12 @@ gcc_jit_struct_set_fields (gcc_jit_struct *struct_type, RETURN_IF_FAIL (fields, ctxt, loc, "NULL fields ptr"); for (int i = 0; i < num_fields; i++) { - RETURN_IF_FAIL (fields[i], ctxt, loc, "NULL field ptr"); + RETURN_IF_FAIL_PRINTF2 ( + fields[i], + ctxt, loc, + "%s: NULL field ptr at index %i", + struct_type->get_debug_string (), + i); RETURN_IF_FAIL_PRINTF2 ( NULL == fields[i]->get_container (), ctxt, loc, @@ -1038,10 +1044,11 @@ gcc_jit_context_new_global (gcc_jit_context *ctxt, kind); RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF1 ( + RETURN_NULL_IF_FAIL_PRINTF2 ( type->has_known_size (), ctxt, loc, - "type has unknown size (type: %s)", + "unknown size for global \"%s\" (type: %s)", + name, type->get_debug_string ()); return (gcc_jit_lvalue *)ctxt->new_global (loc, kind, type, name); @@ -1839,10 +1846,11 @@ gcc_jit_function_new_local (gcc_jit_function *func, "Cannot add locals to an imported function"); RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF1 ( + RETURN_NULL_IF_FAIL_PRINTF2 ( type->has_known_size (), ctxt, loc, - "type has unknown size (type: %s)", + "unknown size for local \"%s\" (type: %s)", + name, type->get_debug_string ()); return (gcc_jit_lvalue *)func->new_local (loc, type, name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f389f54cb06..0eb7a8ce606 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2015-07-08 David Malcolm <dmalcolm@redhat.com> + + PR jit/66783 + * jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c + (verify_code): Update expected error message. + * jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c + (verify_code): Likewise. + * jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c + (verify_code): Likewise. + 2015-07-08 Richard Biener <rguenther@suse.de> PR tree-optimization/66793 diff --git a/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c index c4e144865cf..fb4e54d6078 100644 --- a/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c +++ b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c @@ -27,5 +27,5 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) /* Verify that the correct error message was emitted. */ CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), "gcc_jit_context_new_field:" - " type has unknown size (type: struct opaque)"); + " unknown size for field \"f_opaque\" (type: struct opaque)"); } diff --git a/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c index 5f096afcff6..539b94ec3b3 100644 --- a/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c +++ b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c @@ -28,5 +28,5 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) /* Verify that the correct error message was emitted. */ CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), "gcc_jit_context_new_global:" - " type has unknown size (type: struct opaque)"); + " unknown size for global \"instance_of_opaque\" (type: struct opaque)"); } diff --git a/gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c b/gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c index f263d673070..41fbee2026e 100644 --- a/gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c +++ b/gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c @@ -38,5 +38,5 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) /* Verify that the correct error message was emitted. */ CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), "gcc_jit_function_new_local:" - " type has unknown size (type: struct opaque)"); + " unknown size for local \"i\" (type: struct opaque)"); } |