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.pull/12597/head
parent
30184a48a0
commit
5f659af870
7 changed files with 11 additions and 87 deletions
@ -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 |
@ -1,7 +0,0 @@ |
||||
class MainProg : GLib.Object { |
||||
|
||||
public static int main(string[] args) { |
||||
stdout.printf("Vala is working.\n"); |
||||
return 0; |
||||
} |
||||
} |
@ -1,8 +0,0 @@ |
||||
#warning "something" |
||||
|
||||
int |
||||
somelib(void) |
||||
{ |
||||
int unused_var; |
||||
return 33; |
||||
} |
Loading…
Reference in new issue