aboutsummaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-10-14 08:05:52 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-10-14 08:05:52 +0000
commit56898e437a538c7edc0724a3650f5cb81c9d5721 (patch)
tree94c4cbef454873ea3d58380d67930ee520289c86 /libobjc
parentb9424661f58de6c0aa9dc4c855c1fd913cc06282 (diff)
downloadgcc-56898e437a538c7edc0724a3650f5cb81c9d5721.zip
gcc-56898e437a538c7edc0724a3650f5cb81c9d5721.tar.gz
gcc-56898e437a538c7edc0724a3650f5cb81c9d5721.tar.bz2
[C] Avoid exposing internal details in aka types
The current aka diagnostics can sometimes leak internal details that seem more likely to be distracting than useful. E.g. on aarch64: void f (va_list *va) { *va = 1; } gives: incompatible types when assigning to type ‘va_list’ {aka ‘__va_list’} from type ‘int’ where __va_list isn't something the user is expected to know about. A similar thing happens for C++ on the arm_neon.h-based: float x; int8x8_t y = x; which gives: cannot convert ‘float’ to ‘int8x8_t’ {aka ‘__Int8x8_t’} in initialization This is accurate -- and __Int8x8_t is defined by the AArch64 PCS -- but it's not going to be meaningful to most users. This patch stops the aka code looking through typedefs if all of the following are true: (1) the typedef is built into the compiler or comes from a system header (2) the target of the typedef is anonymous or has a name in the implementation namespace (3) the target type is a tag type or vector type, which have in common that: (a) we print their type names if they have one (b) what we print for anonymous types isn't all that useful ("struct <anonymous>" etc. for tag types, pseudo-C "__vector(N) T" for vector types) The patch does this by recursively looking for the aka type, like the C++ frontend already does. This in turn makes "aka" work for distinct type copies like __Int8x8_t on aarch64, fixing the ??? in aarch64/diag_aka_1.c. 2019-10-14 Richard Sandiford <richard.sandiford@arm.com> gcc/c-family/ * c-common.h (user_facing_original_type_p): Declare. * c-common.c: Include c-spellcheck.h. (user_facing_original_type_p): New function. gcc/c/ * c-objc-common.c (useful_aka_type_p): Replace with... (get_aka_type): ...this new function. Given the original type, decide which aka type to print (if any). Only look through typedefs if user_facing_original_type_p. (print_type): Update accordingly. gcc/testsuite/ * gcc.dg/diag-aka-5.h: New test. * gcc.dg/diag-aka-5a.c: Likewise. * gcc.dg/diag-aka-5b.c: Likewise. * gcc.target/aarch64/diag_aka_1.c (f): Expect an aka to be printed for myvec. From-SVN: r276951
Diffstat (limited to 'libobjc')
0 files changed, 0 insertions, 0 deletions