[vala] Warn if C files are used in combination with -C



commit 69b423b232f189ecb5efd28a6325ae03fa22d73e
Author: Florian Brosch <flo brosch gmail com>
Date:   Thu Jul 10 19:24:09 2014 +0200

    Warn if C files are used in combination with -C

 compiler/valacompiler.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 6583cb2..0ecd3cb 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -292,16 +292,22 @@ class Vala.Compiler {
                context.codegen = new GDBusServerModule ();
 
                bool has_c_files = false;
+               bool has_h_files = false;
 
                foreach (string source in sources) {
                        if (context.add_source_filename (source, run_output, true)) {
                                if (source.has_suffix (".c")) {
                                        has_c_files = true;
+                               } else if (source.has_suffix (".h")) {
+                                       has_h_files = true;
                                }
                        }
                }
                sources = null;
-               
+               if (ccode_only && (has_c_files || has_h_files)) {
+                       Report.warning (null, "C header and source files are ignored when -C or --ccode is 
set");
+               }
+
                if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 
0)) {
                        return quit ();
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]