c: improvements to address space diagnostics
This adds a clarifying "note" to address space mismatch diagnostics.
For example, it improves the diagnostic for
gcc.target/i386/addr-space-typeck-2.c from:
addr-space-typeck-2.c: In function 'test_bad_call':
addr-space-typeck-2.c:12:22: error: passing argument 2 of 'expects_seg_gs'
from pointer to non-enclosed address space
12 | expects_seg_gs (0, ptr, 1);
| ^~~
to:
addr-space-typeck-2.c: In function 'test_bad_call':
addr-space-typeck-2.c:12:22: error: passing argument 2 of 'expects_seg_gs'
from pointer to non-enclosed address space
12 | expects_seg_gs (0, ptr, 1);
| ^~~
addr-space-typeck-2.c:7:51: note: expected '__seg_gs void *' but argument
is of type 'void *'
7 | extern void expects_seg_gs (int i, void __seg_gs *param, int j);
| ~~~~~~~~~~~~~~~^~~~~
I took the liberty of adding the test coverage to i386 since we need
a specific target to test this on.
gcc/c/ChangeLog:
* c-typeck.cc (build_c_cast): Quote names of address spaces in
diagnostics.
(convert_for_assignment): Add a note to address space mismatch
diagnostics, specifying the expected and actual types.
gcc/testsuite/ChangeLog:
* gcc.target/i386/addr-space-typeck-1.c: New test.
* gcc.target/i386/addr-space-typeck-2.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>