bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature requests: $(__FILE__) and $(__LINE__) textual macros


From: Basile Starynkevitch
Subject: Re: feature requests: $(__FILE__) and $(__LINE__) textual macros
Date: Sat, 27 Jan 2024 20:45:44 +0100
User-agent: Mozilla Thunderbird



On 1/27/24 20:27, Basile Starynkevitch wrote:


On 1/27/24 20:11, Paul Smith wrote:
On Sat, 2024-01-27 at 18:06 +0100, Basile Starynkevitch wrote:
For non-trivial GNUmakefile-s on Linux it would be nice to have a
$(__FILE__) and $(__LINE__) textual macros of GNU make.

It would be great if you could provide examples where these would be
useful, especially examples that are not already covered by the output
of the -p option to GNU Make.

make -p don't show (unfortunately) the line number in makefiles. Alternatively, a runtime option for make -p (perhaps --show-line-numbers) would be nice.

I'm not saying we shouldn't introduce these, although I think you
misunderstand how tricky it would be to use them (for example, if you
set:

     FOO = $(__LINE__)

This would be expanded at Makefile parsing time. Not at function invocation time.

If I started to implement it, I would add

   FT_ENTRY ("__LINE__",           0,  0,  0,  func__LINE__),

in GNU make's  src/function.c file.


and probably func__LINE__ would return some ebuf->floc.lineno

[...]

The issue is of course to find the relation between ebuf (which is a local parameter in GNU make source read.c) and the functions in function.c....

My guess is that since GNU make is itself a serial (non-threaded) program, that relation should be simple to find.

Should I have to find it, I would use gdb breakpoint facilities.

Thanks for reading.

Regards.

NB I might perhaps implement such a feature if (and only if) I don't have any copyright assigment to find. In my GCC contributing experience fifteen years ago, that administrative step was really painful. I am too old to start such nightmares again.

--
Basile Starynkevitch             <basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/
See https://github.com/RefPerSys/RefPerSys




reply via email to

[Prev in Thread] Current Thread [Next in Thread]