Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure autotools/gcc to print warnings and errors with the absolute path?

I'm compiling an autotools C based project and I'm getting some warnings and errors. They are displayed like this:

foo.c:123: warning: some message

I would like them to be displayed like this:

/full/path/to/foo.c:123: warning: some message

I know this is not configurable through gcc except by passing to it the full file path itself, so I guess that this must be configurable through autoconf/automake.

Is this possible? If so, how?

like image 200
ivarec Avatar asked Oct 22 '25 05:10

ivarec


1 Answers

I don't know how to do that and suspect that it cannot be done. BUT if your higher goal is to find the files referenced by the warnings it may be enough to use Emacs:

Open a file in the top source directory, like C-x C-f configure.ac RET, run the compilation: M-x compile RET (possibly edit the make command) RET. When you see a warning in the compilation buffer, use C-x backtick (C-x `) to display the source location.

Emacs manages this by parsing the "Entering directory /foo" and "Leaving directory /foo" messages from make so you may want to emulate that.

like image 93
Martin Vidner Avatar answered Oct 24 '25 12:10

Martin Vidner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!