Silvius Rus - Re: Patch: New implementation of -Wstrict-aliasing (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Andrew Pinski wrote:

[...]
I also think the warning should not really be using %s at all, there are
pretty-printers for a reason, they really should be quoted if %s is to
be used.

1. I switched to using %H do display location information, but got into problems. It appears that only the first instance of %H is printed.

location_t location1, location2, location3; ... warning (OPT_Wstrict_aliasing, "%H defined at %H is used at %H.", &location1, &location2, &location3); Here is the last part of the output: [...] defined at is used at .

2. Also, I am using "%s" to print a preceding "*" to make it clear when the warning involves pointers. It is confusing to say that PTR is aliased to OBJECT, when in reality it is *PTR that is aliased to OBJECT. This gets worse when OBJECT is a pointer itself. Since the analysis is based on points-to information, I cannot always get accurate line numbers, so displaying as much information about the objects is important. I do not understand how I could use pretty printers here.
I could write separate versions of the warning, with and without the "*", but with two variables that would mean 4 versions of the essentially same thing.3. I could not find documentation for format extensions and it is not clear to me which of them I can use from the backend. Could you please point me to it if there is any (or to locations in the source code)?

Thank you, Silvius


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]