On 04/22/2017 11:49 AM, Tom de Vries wrote:
Hi,

there are currently two types of line number supported in
dg-{error,warning,message,bogus} directives: absolute and relative. With an absolute line number, it's immediately clear what line number is meant, but when a line is added at the start of the file, the line number needs to be updated. With a relative line number, that problem is solved, but when relative line numbers become large, it becomes less clear what line it refers to, and when adding a line inbetween the directive using the relative line number and the line it refers to, the relative line number still needs to be updated.

This patch adds a directive dg-save-linenr with argument varname, that saves the line number of the directive in a variable varname, which can be used as line number in dg directives.

Testing status:
- tested updated test-case objc.dg/try-catch-12.m
- ran tree-ssa.exp

RFC:
- good idea?
Yes.

- naming of directive dg-save-linenr (dg-linenr, dg-save-line-nr,
   dg-save-lineno, dg-save-line-number, etc)
No strong opinions. We often use "save" in various ways within the GCC source for similar concepts, so any of those work for me.

- allowed variable names (currently: start with letter, followed by
   alphanumerical or underscore)
Seems reasonable.

- should we use a prefix symbol or some such when the variable is used
   (and possibly defined as well)? F.i.:
   /* { dg-save-linenr %some_func_decl } *./
   /* { dg-message "but argument is of type" "" { target *-*-* }
        %some_func_decl } */
I'm not sure what the value here would be.

Jeff

Reply via email to