This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: New implementation of -Wstrict-aliasing
- From: Silvius Rus <rus at google dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Feb 2007 19:18:56 -0800
- Subject: Re: Patch: New implementation of -Wstrict-aliasing
- References: <45B17A75.40009@google.com> <1169333920.2636.20.camel@celery.andrew.com>
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