From 354c4bcaeb093e1b8ef161985901b23957314bc0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 8 Oct 2016 01:09:48 +0530 Subject: [PATCH] Test that warnings apply to C files in Vala targets --- test cases/failing build/1 vala c werror/meson.build | 10 ++++++++++ test cases/failing build/1 vala c werror/prog.vala | 7 +++++++ test cases/failing build/1 vala c werror/unused-var.c | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 test cases/failing build/1 vala c werror/meson.build create mode 100644 test cases/failing build/1 vala c werror/prog.vala create mode 100644 test cases/failing build/1 vala c werror/unused-var.c diff --git a/test cases/failing build/1 vala c werror/meson.build b/test cases/failing build/1 vala c werror/meson.build new file mode 100644 index 000000000..736d7aa43 --- /dev/null +++ b/test cases/failing build/1 vala c werror/meson.build @@ -0,0 +1,10 @@ +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 new file mode 100644 index 000000000..638e77660 --- /dev/null +++ b/test cases/failing build/1 vala c werror/prog.vala @@ -0,0 +1,7 @@ +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 new file mode 100644 index 000000000..e11d64c8c --- /dev/null +++ b/test cases/failing build/1 vala c werror/unused-var.c @@ -0,0 +1,6 @@ +int +somelib(void) +{ + int unused_var; + return 33; +}