Re: [PATCH] kconfig: drop filename and line number prefix from warning/error-if macros

From: Boris Kolpackov
Date: Mon Dec 21 2020 - 09:23:41 EST


[Copying some of my comments from another reply.]

Masahiro Yamada <masahiroy@xxxxxxxxxx> writes:

> When I implemented the Kconfig macro language, I took the GNU Make
> behavior as a reference in general, but I did not follow the message
> format of $(error ...) to avoid that annoyance.
>
> So, the following code in Kconfig:
>
> $(warning-if,y,This is the first line)
> $(warning-if,y,This is the second line)
> $(error-if,y,This is the last line)
>
> ... will print the messages in a consistent format:
>
> Kconfig:1: This is the first line
> Kconfig:2: This is the second line
> Kconfig:3: This is the last line

IMO, there is a flaw with this approach: there is no way for the
user to know that these three lines are about the same error.

If we want this ability, then let's find a way do it properly
rather than spreading further hacks. For example, in the build
system I am working on, we have suport for multi-line diagnostics
records that to the user look like this:

Makefile:3: error: This is the first line
This is the second line
This is the last line


> But, in hindsight, the built-in functions should have only primitive
> functionality to print the given message without any prefix. The lesson
> I learned from GNU Make was such a prefix is easy to add, difficult to
> remove.
>
> This commit changes the built-in functions, warning-if and error-if, to
> not print the file name or the line number.

Wouldn't automatically showing the position in the Kconfig file
where the error/warning has originated be much, much more useful
than the occasional need to print multi-line messages?