diff options
author | Marek Polacek <polacek@redhat.com> | 2022-09-29 17:49:32 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-10-10 14:16:44 -0400 |
commit | 67efffec943656a509e036cd3c785a5c3d6885e1 (patch) | |
tree | 11e066be82c3dc664f3c67e9dfeb79a51dfc7113 /gcc/tree-cfg.cc | |
parent | 248c8aeebc49aae3fd96bd587367d12e7c8b3c3a (diff) | |
download | gcc-67efffec943656a509e036cd3c785a5c3d6885e1.zip gcc-67efffec943656a509e036cd3c785a5c3d6885e1.tar.gz gcc-67efffec943656a509e036cd3c785a5c3d6885e1.tar.bz2 |
c-family: ICE with [[gnu::nocf_check]] [PR106937]
When getting the name of an attribute, we ought to use
get_attribute_name, which handles both [[]] and __attribute__(())
forms. Failure to do so may result in an ICE, like here.
pp_c_attributes_display wasn't able to print the [[]] form of
attributes, so this patch teaches it to.
When printing a pointer to function with a standard attribute, the attribute
should be printed after the parameter-list. With this patch we print:
aka 'void (*)(int) [[gnu::nocf_check]]'
or, in C++ with noexcept:
aka 'void (*)(int) noexcept [[gnu::nocf_check]]'
pp_c_attributes has been unused since its introduction in r56273 so
this patch removes it.
PR c++/106937
gcc/c-family/ChangeLog:
* c-pretty-print.cc (pp_c_specifier_qualifier_list): Print only GNU
attributes here.
(c_pretty_printer::direct_abstract_declarator): Print the standard [[]]
attributes here.
(pp_c_attributes): Remove.
(pp_c_attributes_display): Print the [[]] form if appropriate. Use
get_attribute_name. Don't print a trailing space when printing the
[[]] form.
* c-pretty-print.h (pp_c_attributes): Remove.
gcc/cp/ChangeLog:
* error.cc: Include "attribs.h".
(dump_type_prefix): Print only GNU attributes here.
(dump_type_suffix): Print standard attributes here.
gcc/testsuite/ChangeLog:
* c-c++-common/pointer-to-fn1.c: New test.
Diffstat (limited to 'gcc/tree-cfg.cc')
0 files changed, 0 insertions, 0 deletions