aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2023-12-05 14:26:54 -0500
committerEli Schwartz <eschwartz93@gmail.com>2023-12-05 19:51:56 -0500
commit5f659af870011e74299d1455a65c2cd5f5ace51f (patch)
treedf320935a1f2883795e72e284715004800c8b7e5 /test cases
parent30184a48a032e6a2a6dbf0a76e437aa676c3e4aa (diff)
downloadmeson-5f659af870011e74299d1455a65c2cd5f5ace51f.zip
meson-5f659af870011e74299d1455a65c2cd5f5ace51f.tar.gz
meson-5f659af870011e74299d1455a65c2cd5f5ace51f.tar.bz2
ninja backend: don't hide all compiler warnings for transpiled languages
This was originally added for vala only, with the rationale that vala generates bad code that has warnings. Unfortunately, the rationale was fatally flawed. The compiler warns about a number of things, which the user can control depending on their code (or their code generator's code), but some of those things are absolutely critical to warn about. In particular, GCC 14 and clang 17 are updating their defaults to warn -- and error by default for -- invalid C code that breaks the standard, but has been silently accepted for over 20 years "because lots of people do it". The code in question is UB, and compilers will generate faulty machine code that behaves erroneously and probably has a mass of CVEs waiting to happen. Compiler warnings are NOT safe to just... universally turn off. Compiler warnings could be either: - coding style lints - threatening statements that the code is factually and behaviorally wrong There is no magic bullet to ignore the former while respecting the latter. And the very last thing we should ever do is pass `-w`, since that causes ALL warnings to be disabled, even the manually added `-Werror=XXX`. If vala generated code creates warnings, then the vala compiler can decrease the log level by generating better code, or by adding warning suppression pragmas for *specific* issues, such as unused functions.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/failing build/1 vala c werror/meson.build10
-rw-r--r--test cases/failing build/1 vala c werror/prog.vala7
-rw-r--r--test cases/failing build/1 vala c werror/unused-var.c8
-rw-r--r--test cases/vala/5 target glib/meson.build4
4 files changed, 0 insertions, 29 deletions
diff --git a/test cases/failing build/1 vala c werror/meson.build b/test cases/failing build/1 vala c werror/meson.build
deleted file mode 100644
index 736d7aa..0000000
--- a/test cases/failing build/1 vala c werror/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-project('valatest', 'c', default_options : 'werror=true')
-
-if find_program('valac', required : false).found()
- add_languages('vala')
- valadeps = [dependency('glib-2.0'), dependency('gobject-2.0')]
- # Must fail due to -Werror and unused variable in C file
- executable('valaprog', 'prog.vala', 'unused-var.c', dependencies : valadeps)
-else
- executable('failprog', 'unused-var.c')
-endif
diff --git a/test cases/failing build/1 vala c werror/prog.vala b/test cases/failing build/1 vala c werror/prog.vala
deleted file mode 100644
index 638e776..0000000
--- a/test cases/failing build/1 vala c werror/prog.vala
+++ /dev/null
@@ -1,7 +0,0 @@
-class MainProg : GLib.Object {
-
- public static int main(string[] args) {
- stdout.printf("Vala is working.\n");
- return 0;
- }
-}
diff --git a/test cases/failing build/1 vala c werror/unused-var.c b/test cases/failing build/1 vala c werror/unused-var.c
deleted file mode 100644
index 6b85078..0000000
--- a/test cases/failing build/1 vala c werror/unused-var.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#warning "something"
-
-int
-somelib(void)
-{
- int unused_var;
- return 33;
-}
diff --git a/test cases/vala/5 target glib/meson.build b/test cases/vala/5 target glib/meson.build
index f285d9f..089bb3c 100644
--- a/test cases/vala/5 target glib/meson.build
+++ b/test cases/vala/5 target glib/meson.build
@@ -1,9 +1,5 @@
project('valatest', 'vala', 'c')
-if not meson.is_unity()
- add_global_arguments('-Werror', language : 'c')
-endif
-
valadeps = [dependency('glib-2.0', version : '>=2.32'), dependency('gobject-2.0')]
e = executable('valaprog', 'GLib.Thread.vala', 'retcode.c', dependencies : valadeps)