On 05/17/2012 10:33 AM, Gabriel Dos Reis wrote:
On Thu, May 17, 2012 at 2:52 AM, Paolo Carlini<paolo.carl...@oracle.com> wrote:
On 05/17/2012 09:48 AM, Paolo Carlini wrote:
Can we concisely characterize those messages and exclude them from the
gcc_assert?
Well, if don't quickly figure out something better, I guess we can always
add the assert at the beginning of warning_at, error_at, etc.
I am still puzzled by why we need to assert, as opposed to just ignore, unless
we have a plan to make a wholesale move -- but even there I am bit nervous.
Eh, don't ask me ;) Anyway, in terms of testing that we aren't screwing
up anything in the C++ front-end, the testsuite just passed with the
below p3 attached. That's good.
If we wanted to apply it we would have to tweak a bit objc, because it
wants to use warning_at (0, 0, ..). Also, as you can see, I didn't test
asserts in permerror, inform, because explicitly passing 0 has uses in
the C++ front-end, and also pedwarn, because the comment before it
explains that pedwarn (0, ...) can be useful in some cases.
Thus, I guess, basing on this further positive test and the previous
feedback from Jason, I 'm going ahead with the last complete patch I
posted for 44516 + the tweak named p2. I'm going to boot and test again
and commit the whole thing.
If we want to add something in terms of asserts, that seems anyway quite
an independent issue, just let me know.
Thanks!
Paolo.
/////////////////////////
Index: diagnostic.c
===================================================================
--- diagnostic.c (revision 187624)
+++ diagnostic.c (working copy)
@@ -798,6 +798,8 @@ warning_at (location_t location, int opt, const ch
diagnostic_info diagnostic;
va_list ap;
bool ret;
+
+ gcc_assert (location != UNKNOWN_LOCATION);
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
@@ -881,6 +883,8 @@ error_n (location_t location, int n, const char *s
diagnostic_info diagnostic;
va_list ap;
+ gcc_assert (location != UNKNOWN_LOCATION);
+
va_start (ap, plural_gmsgid);
diagnostic_set_info_translated (&diagnostic,
ngettext (singular_gmsgid, plural_gmsgid, n),
@@ -891,13 +895,15 @@ error_n (location_t location, int n, const char *s
/* Same as ebove, but use location LOC instead of input_location. */
void
-error_at (location_t loc, const char *gmsgid, ...)
+error_at (location_t location, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
+ gcc_assert (location != UNKNOWN_LOCATION);
+
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_ERROR);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_ERROR);
report_diagnostic (&diagnostic);
va_end (ap);
}