[C/C++ PATCH] Fix up build of GCC 4.6 and earlier with GCC 9+ (PR c/90677)

Jakub Jelinek jakub@redhat.com
Wed Nov 20 10:51:00 GMT 2019


On Wed, Nov 20, 2019 at 11:25:46AM +0100, Richard Biener wrote:
> Nothing on the specific patch but I wonder if we should change the
> error ()s in init_dynamic_diag_info to warnings to make stage1 uses
> fine?  That probably then boils down to ignoring __gcc_diag__ formats
> when initializing wasn't suceessful.

Turning the errors into warnings is fine with me, but I think it still
doesn't hurt to handle the common case of cgraph_node being a function
the way the patch does, without any warning, as otherwise it would warn on
every single GCC file.
There is another thing, gimple, in the past we had typedef union ... *gimple;
and now we have struct gimple instead.  Though, both %G and %C that use
gimple * or cgraph_node * aren't going to appear in GCC 4.6 or earlier
anyway, so as long as we don't error (or ideally warn) all the time
on that, we just don't care.

> It also looks like we repeatedly do work in init_dynamic_diag_info ...

Yes, but only as long as the types aren't found yet.  I bet it is for the
case that there is
prototype with __gcc_diag__
struct cgraph_node;
or similar ordering, but that is just a guess.

	Jakub



More information about the Gcc-patches mailing list