This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to fix diagnostic format warnings in cp/ dir
"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
| > > From: Gabriel Dos Reis <gdr@integrable-solutions.net>
| > >
| > > the fix is to supply the location info directly, i.e.:
| > >
| > > cp_error ("%Hno specifiers", &DECL_SOURCE_LOCATION (extra_arg));
^^^^^^^^
| > >
| > > -- Gaby
| >
| > Ok?
| >
| > 2003-06-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
| Actually following this course yields several extra testsuite errors.
| E.g
|
| > FAIL: g++.old-deja/g++.jason/crash10.C (test for excess errors)
| > FAIL: g++.old-deja/g++.other/anon4.C (test for errors, line 13)
| > FAIL: g++.old-deja/g++.other/anon4.C (test for excess errors)
| > FAIL: g++.old-deja/g++.other/enum2.C (test for errors, line 9)
| > FAIL: g++.old-deja/g++.other/enum2.C (test for excess errors)
| > FAIL: g++.old-deja/g++.pt/friend23.C (test for errors, line 3)
| > FAIL: g++.old-deja/g++.pt/friend23.C (test for excess errors)
| > FAIL: g++.old-deja/g++.pt/redecl1.C (test for errors, line 9)
| > FAIL: g++.old-deja/g++.pt/redecl1.C (test for errors, line 15)
| > FAIL: g++.old-deja/g++.pt/redecl1.C (test for errors, line 19)
| > FAIL: g++.old-deja/g++.pt/redecl1.C (test for errors, line 22)
| > FAIL: g++.old-deja/g++.pt/redecl1.C (test for excess errors)
|
|
| Some are like this:
| > g++.jason/crash10.C:8: internal compiler error: unexpected letter
| > `H' in locate_error
|
| So the cp_*_at functions don't seems to accept %H because of the
| locate_error() wrapper.
Yes, that is why I did suggest using cp_error -- not cp_error_at -- in
the situation you descirbed (e.g. trailing arguments)
| I also get errors like this:
|
| > g++.other/anon4.C:15: internal compiler error: tree check: expected
| > class 'd', have 't' (union_type) in fixup_anonymous_aggr, at cp/decl.c:6692
|
| > g++.other/enum2.C:14: internal compiler error: tree check: expected
| > class 'd', have 't' (enumeral_type) in start_enum, at cp/decl.c:13014
|
| So DECL_SOURCE_LOCATION doesn't work on types. (Obvious in hindsight?)
1) DECL_SOURCE_LOCATION works only on _DECLs (e.g. variables, functions,
typedefs, ...).
2) Every type has a _DECL associated with it: the TYPE_MAIN_DECL.
3) For a overload set, you can get the _DECL for one of the function
through OVL_FUNCTION
| Anyway, what should I do?
I would suggest you replace the spurious uses of cp_error_at with
cp_error (as indicated in the previous message) and you use
&DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (t))
when t is a type and
&DECL_SOURCE_LOCATION (OVL_FUNCTION (t))
when t is an overload set.
| May I install the original patch? (That one
| passed the testsuite.)
No.
Thanks for your effort and patience.
-- Gaby