[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 --- Comment #10 from Jakub Jelinek --- Author: jakub Date: Fri Nov 22 21:45:27 2019 New Revision: 278634 URL: https://gcc.gnu.org/viewcvs?rev=278634=gcc=rev Log: PR c/90677 * c-common.h (identifier_global_tag): Declare. * c-format.c (get_pointer_to_named_type): Renamed to ... (get_named_type): ... this. Use identifier_global_tag instead of identifier_global_value, handle the return value being a TYPE_P. (init_dynamic_diag_info): Adjust get_pointer_to_named_type callers to call get_named_type instead. Formatting fixes. c/ * c-decl.c (identifier_global_tag): Define. cp/ * cp-objcp-common.c (identifier_global_tag): Define. testsuite/ * c-c++-common/pr90677.c: New test. Added: trunk/gcc/testsuite/c-c++-common/pr90677.c Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.h trunk/gcc/c-family/c-format.c trunk/gcc/c/ChangeLog trunk/gcc/c/c-decl.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-objcp-common.c trunk/gcc/testsuite/ChangeLog
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Bernd Schmidt changed: What|Removed |Added CC||bernds at gcc dot gnu.org --- Comment #9 from Bernd Schmidt --- Created attachment 47333 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47333=edit Candidate patch I was actually using the following during testing recently. I can't see a reason to emit an error in that function. This was bootstrapped and tested on the gcc135 machine.
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #8 from Jakub Jelinek --- Created attachment 47297 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47297=edit gcc10-pr90677.patch Untested fix.
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- Better reduced testcase that shows what actually is happening in the older GCCs: struct cgraph_node; struct tree_node; typedef struct tree_node *tree; struct cgraph_node *cgraph_node (tree); void foo (int, const char *, ...) __attribute__((__format__(__gcc_diag__, 2, 3)));
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Jakub Jelinek changed: What|Removed |Added Target Milestone|9.2 |9.3 --- Comment #6 from Jakub Jelinek --- GCC 9.2 has been released.
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 --- Comment #5 from Sergei Trofimovich --- No problem! Thank you for the very detailed explanation! Name stealing makes sense. I managed to craft a workaround for old gcc-4.6.4 source code locally [1] and not blocked by proper fix. [1] the workaround: --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -305,7 +305,7 @@ extern void pp_base_append_text (pretty_printer *, const char *, const char *); /* This header may be included before diagnostics-core.h, hence the duplicate definitions to allow for GCC-specific formats. */ -#if GCC_VERSION >= 3005 +#if (GCC_VERSION >= 3005) && (GCC_VERSION != 9001) /* 9.1.0 is buggy: https://gcc.gnu.org/PR90677 */ #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (__gcc_diag__, m ,n))) ATTRIBUTE_NONNULL(m) #else #define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Richard Biener changed: What|Removed |Added Priority|P3 |P2
[Bug c/90677] [9/10 Regression] gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90677 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Known to work||8.3.1 Keywords||rejects-valid Last reconfirmed||2019-05-30 CC||dmalcolm at gcc dot gnu.org Ever confirmed|0 |1 Summary|gcc-9.1.0 fails to build|[9/10 Regression] gcc-9.1.0 |__gcc_diag__ souce: error: |fails to build __gcc_diag__ |'cgraph_node' is not|souce: error: 'cgraph_node' |defined as a type |is not defined as a type Target Milestone|--- |9.2 Known to fail||10.0, 9.1.0 --- Comment #4 from Jonathan Wakely --- Sorry, I misunderstood the report and the reduced example. I agree that your reduced code should compile. The regression started with r265918. It seems that after this change the identifier 'cgraph_node' can only be used for types, not variables. Since it's not a reserved name and could occur in user code, that's a bug. dump_printf: add "%C" for dumping cgraph_node * This patch implements support for %C in dump_printf for dumping cgraph_node *. (I would have preferred to have a code for printing symtab_node * and both subclasses, but there doesn't seem to be a good way for -Wformat to handle inheritance, so, failing that, I went with this approach). gcc/c-family/ChangeLog: * c-format.c (local_cgraph_node_ptr_node): New variable. (gcc_dump_printf_char_table): Add entry for %C. (get_pointer_to_named_type): New function, taken from the handling code for "gimple *" from... (init_dynamic_diag_info): ...here. Add handling for "cgraph_node *". * c-format.h (T_CGRAPH_NODE): New. gcc/ChangeLog: * dump-context.h (ASSERT_IS_CGRAPH_NODE): New macro. * dumpfile.c (make_item_for_dump_cgraph_node): Move to before... (dump_pretty_printer::decode_format): Implement "%C" for cgraph_node *. (selftest::test_capture_of_dump_calls): Rename "where" to "stmt_loc". Convert test_decl to a function decl and set its location. Add a symbol_table_test RAII instance and a cgraph_node, using it to test "%C" and dump_symtab_node. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-10.c (cgraph_node): New typedef. (test_dump): Add testing of %C.