Re: [PATCH] modpost: allow modpost to fail on warnings

From: Pierre-Louis Bossart
Date: Thu Sep 24 2020 - 14:13:41 EST




I think [1] should be an error instead of a warning
by default.

would the following patch be what you have in mind?


No.
error() does not exist.

merror() exists, but the difference from warn()
is just a prefix.

If any error happens, modpost should return the error code.

Sorry, I am not able to understand your recommendation. Existing code which calls merror() does not exit with an error code, e.g.

static void sym_update_namespace(const char *symname, const char *namespace)
{
struct symbol *s = find_symbol(symname);

/*
* That symbol should have been created earlier and thus this is
* actually an assertion.
*/
if (!s) {
merror("Could not update namespace(%s) for symbol %s\n",
namespace, symname);
return;
}

What would be suggestion be then in this case?

change all functions to return -EINVAL after each use of merror() or something?

Or just add an exit(1) after all uses of merror()?

If yes, also wondering if we can still add the option to treat warnings
as errors as an opt-in behavior?


I want to add a new option only when it is necessary to do so.

I am not sure which warnings are real warnings.

That was the point of the suggested option, treat all warnings as errors and ignore the warning if it's no big deal. it's standard with gcc -Werror, it's be good to extend this to modpost - or what would be the drawback of doing so?