Skip to content

Commit 2a11665

Browse files
Matthew Wilcoxsravnborg
authored andcommitted
kbuild: distinguish between errors and warnings in modpost
Some of modpost's warnings are fatal, and some are not. Adopt the compiler distinction between errors and warnings by calling merror() for fatal diagnostics and warn() for non-fatal ones. merror() was used as replacemtn for error() to avoid clash with glibc Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 63431e7 commit 2a11665

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎scripts/mod/modpost.c‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ void warn(const char *fmt, ...)
5555
va_end(arglist);
5656
}
5757

58+
void merror(const char *fmt, ...)
59+
{
60+
va_list arglist;
61+
62+
fprintf(stderr, "ERROR: ");
63+
64+
va_start(arglist, fmt);
65+
vfprintf(stderr, fmt, arglist);
66+
va_end(arglist);
67+
}
68+
5869
static int is_vmlinux(const char *modname)
5970
{
6071
const char *myname;
@@ -1307,9 +1318,14 @@ static int add_versions(struct buffer *b, struct module *mod)
13071318
exp = find_symbol(s->name);
13081319
if (!exp || exp->module == mod) {
13091320
if (have_vmlinux && !s->weak) {
1310-
warn("\"%s\" [%s.ko] undefined!\n",
1311-
s->name, mod->name);
1312-
err = warn_unresolved ? 0 : 1;
1321+
if (warn_unresolved) {
1322+
warn("\"%s\" [%s.ko] undefined!\n",
1323+
s->name, mod->name);
1324+
} else {
1325+
merror("\"%s\" [%s.ko] undefined!\n",
1326+
s->name, mod->name);
1327+
err = 1;
1328+
}
13131329
}
13141330
continue;
13151331
}

‎scripts/mod/modpost.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,4 @@ void release_file(void *file, unsigned long size);
145145

146146
void fatal(const char *fmt, ...);
147147
void warn(const char *fmt, ...);
148+
void merror(const char *fmt, ...);

0 commit comments

Comments
 (0)