This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA [PR objc/29200][diagnostic] Make diagnostics translation friendly
On Thu, 2009-04-09 at 15:32 +0200, David Ayers wrote:
> (trimmed the CC: to reduce spamming... hope it's appropriate.)
>
> Am Donnerstag, den 09.04.2009, 12:35 +0000 schrieb Joseph S. Myers:
> > On Thu, 9 Apr 2009, David Ayers wrote:
>
> > Yes. There is an error or warning, and then subsequent messages adding
> > supplementary information should use "inform".
> >
> > > It seems that the test suite doesn't differentiate between warning and
> > > inform, so there is no need to adapt anything there.
> >
> > I think "inform" calls need dg-message instead of dg-warning, but maybe
> > ObjC tests don't distinguish errors/warnings/informs yet (some languages
> > do).
>
> If I call the test suite with:
> make check-objc RUNTESTFLAGS="dg.exp=method-9.m -v"
> I get:
>
> ../method-9.m:35: warning: multiple methods named '-initWithData:' found
> ../method-9.m:11: note: using '-(id)initWithData:(Object *)data'
> ../method-9.m:19: note: also found '-(id)initWithData:(id <MyObject,
> MyCoding>)data'
> ../method-9.m:15: note: also found '-(id)initWithData:(int)data'
> ../method-9.m:35: warning: passing argument 1 of 'initWithData:' from
> distinct Objective-C type
>
> with the patch. So the output seems correct yet the test passes as is
> with 'dg-warning'.
>
> Grepping through gcc/testsuite reveals that 'dg-message' seems to
> handled by lib/gcc-dg.exp which is included by lib/objc-dg.exp (which in
> turn is included by objc.dg/dg.exp). Yet if I replace the corresponding
> dg-warning with dg-message in that test case, I get:
>
> FAIL: objc.dg/method-9.m (test for excess errors)
>
> I've CC'd test suite maintainer: What are prerequisites for 'dg-message'
> to catch 'inform' diagnostics rather than 'dg-warning'?
>
> Anyway, I'll adapt the ObjC test suite to handle 'inform' diagnostics
> with 'dg-message' in a separate patch.
The compiler tests for C and C++ support dg-error, dg-warning, and
dg-message, where dg-error and dg-warning look for a particular
prefix for the message. Those versions of dg-error and dg-warning
are enabled if the language support (in this case in gcc.exp and
g++.exp) set gcc_error_prefix and gcc_warning_prefix. I'm not sure
if dg-message is supported without overriding dg-warning.
I suspect it wouldn't be difficult to convert the objc tests to use
the overrides of dg-error and dg-warning, although it might involve
modifying tests that specifically look for "error" or "warning" in
the messages. For "inform" you can use the current dg-warning, or
the new dg-message, with "inform" as part of the search string.
Janis