This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC, testsuite] Add dg-save-linenr


Hi Tom,

sorry for chiming in so very late: I've been on vacation and sick in
between... 

> On 04/24/2017 05:20 PM, David Malcolm wrote:
>> On Sat, 2017-04-22 at 19:49 +0200, 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?
>>
>> Excellent idea; thanks!  There are various places where I'd find this
>> useful.
>>
>>> - naming of directive dg-save-linenr (dg-linenr, dg-save-line-nr,
>>>    dg-save-lineno, dg-save-line-number, etc)
>>
>> How about just "dg-line"?  (if it's not already taken)
>
> Done.

I'd have preferred dg-linenum: it clarifiers that it's a number and we
have precedent in DejaGnu's dg-linenum-format and dg-format-linenum...

>>> - error message formulation
>>
>> Nit: the new function should have a leading comment, explaining the
>> usage.
>>
>
> Done.

Not only that, but the new proc needs documenting in sourcebuild.texi.
(It's already way too hard for testsuite writers to find their way with
the documentation; if parts are missing, it gets next to impossible.)

Besides, it may be worthwhile contributing/suggesting this upstream.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]