[PATCH v1 kbuild for-next 2/2] modpost: add Kconfig option to report warnings as errors

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

 



Add a Kconfig option to cause modpost to report warnings as errors.
This is a simplistic implementation in that modpost only reports the
first warning as an error and subsequent unreported warnings that will
kill the build may still exist.

Signed-off-by: Jonathan Toppins <jtoppins@xxxxxxxxxxxxxxxxxxx>
---
 lib/Kconfig.debug     |   14 ++++++++++++++
 scripts/mod/modpost.c |    5 +++++
 2 files changed, 19 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 0b288db..c419138 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -361,6 +361,20 @@ config DEBUG_FORCE_CC_WARNINGS_TO_ERRORS
 	  .
 	  If unsure say y.
 
+config DEBUG_FORCE_MODPOST_WARNINGS_TO_ERRORS
+	bool "Force modpost warnings to errors"
+	default n
+	help
+	  Force warnings generated by modpost to be reported as errors.
+	  .
+	  Another build time setting to encourage some action be taken by
+	  the developer to fix the problem. Since there is not an easy
+	  suppression mechanism for things that are reported as warnings
+	  but are determined to be acceptable the default is to not enable
+	  this option.
+	  .
+	  If unsure say n.
+
 endmenu # "Compiler options"
 
 config MAGIC_SYSRQ
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d439856..d430eb6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -70,6 +70,11 @@ PRINTF void warn(const char *fmt, ...)
 	va_start(arglist, fmt);
 	vfprintf(stderr, fmt, arglist);
 	va_end(arglist);
+
+#ifdef CONFIG_DEBUG_FORCE_MODPOST_WARNINGS_TO_ERRORS
+	fprintf(stderr, "modpost: warnings treated as errors.\n");
+	exit(1);
+#endif
 }
 
 PRINTF void merror(const char *fmt, ...)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux