aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-09 00:12:26 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-16 06:16:07 +0200
commit518fd8c131c64e10b5762532141e0f31134ec20d (patch)
treee29f72dd9e38995bce2c295c6a25b19274e01a65 /validation
parenta697a21927bddb091ba1a6d88c4db01ef2f58092 (diff)
downloadsparse-dev-518fd8c131c64e10b5762532141e0f31134ec20d.tar.gz
add support for -fdiagnostic-prefix[=prefix]
When using sparse it's common to compile a file and directly run sparse on the same file, like it is done for the kernel. In this case, error messages from sparse are interspersed with those from the compiler. It's thus not always easy to know from which tools they come. Fix this by allowing to prefix all the diagnostic messages by some configurable string, by default "sparse". More exactly, an error message that was emitted like: file.c:<line>:<col>: error: this is invalid code can now be emitted as: file.c:<line>:<col>: sparse: error: this is invalid code Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/fdiag-prefix.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/validation/fdiag-prefix.c b/validation/fdiag-prefix.c
new file mode 100644
index 00000000..71160d45
--- /dev/null
+++ b/validation/fdiag-prefix.c
@@ -0,0 +1,11 @@
+int a.
+
+/*
+ * check-name: fdiag-prefix
+ * check-command: sparse -fdiagnostic-prefix=prefix $file
+ *
+ * check-error-start
+fdiag-prefix.c:1:6: prefix: error: Expected ; at end of declaration
+fdiag-prefix.c:1:6: prefix: error: got .
+ * check-error-end
+ */