aboutsummaryrefslogtreecommitdiffstats
path: root/tests/clazy
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2016-09-03 12:22:31 +0100
committerSergio Martins <smartins@kde.org>2016-09-03 12:22:31 +0100
commita61d424ee07a835dbcb05d035211e03c64e19830 (patch)
treea5481188e324802f8fd9e9a4281bd7ddb4608d4b /tests/clazy
parent65e60ca656997ff6aa39d03e096c9487242e4979 (diff)
Emit an error instead of warning if -Werror was supplied
BUG: 368072
Diffstat (limited to 'tests/clazy')
-rw-r--r--tests/clazy/config.json5
-rw-r--r--tests/clazy/werror.cpp13
-rw-r--r--tests/clazy/werror.cpp.expected1
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/clazy/config.json b/tests/clazy/config.json
index deea2973..09925fd0 100644
--- a/tests/clazy/config.json
+++ b/tests/clazy/config.json
@@ -13,6 +13,11 @@
{
"filename" : "suppressionsWholeFile.cpp",
"checks" : ["qstring-allocations", "foreach"]
+ },
+ {
+ "filename" : "werror.cpp",
+ "flags" : "-Werror",
+ "checks" : ["foreach"]
}
]
}
diff --git a/tests/clazy/werror.cpp b/tests/clazy/werror.cpp
new file mode 100644
index 00000000..7e73ff0e
--- /dev/null
+++ b/tests/clazy/werror.cpp
@@ -0,0 +1,13 @@
+#include <QtCore/QString>
+#include <QtCore/QList>
+
+struct BigTrivial
+{
+ int a, b, c, d, e;
+};
+
+void test()
+{
+ QList<BigTrivial> list;
+ foreach (BigTrivial b, list) { }
+}
diff --git a/tests/clazy/werror.cpp.expected b/tests/clazy/werror.cpp.expected
new file mode 100644
index 00000000..713e53b7
--- /dev/null
+++ b/tests/clazy/werror.cpp.expected
@@ -0,0 +1 @@
+clazy/werror.cpp:12:14: error: Missing reference in foreach with sizeof(T) = 20 bytes (struct BigTrivial) [-Wclazy-foreach]