]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valac: Do not check for an entry point when using C source files
authorpancake <pancake@youterm.com>
Sun, 15 Nov 2009 22:49:45 +0000 (23:49 +0100)
committerJürg Billeter <j@bitron.ch>
Sun, 15 Nov 2009 22:49:45 +0000 (23:49 +0100)
compiler/valacompiler.vala

index 4ce0744f93becc8028d0c257bba50224510ee488..11c35fce342c8ded5cf2aa8724d232e0dfdfa352 100644 (file)
@@ -292,6 +292,8 @@ class Vala.Compiler {
                        return quit ();
                }
                
+               bool has_c_files = false;
+
                foreach (string source in sources) {
                        if (FileUtils.test (source, FileTest.EXISTS)) {
                                var rpath = realpath (source);
@@ -315,6 +317,7 @@ class Vala.Compiler {
                                        context.add_source_file (new SourceFile (context, rpath, true));
                                } else if (source.has_suffix (".c")) {
                                        context.add_c_source_file (rpath);
+                                       has_c_files = true;
                                } else {
                                        Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
                                }
@@ -359,7 +362,7 @@ class Vala.Compiler {
 
                if (!ccode_only && !compile_only && library == null) {
                        // building program, require entry point
-                       if (context.entry_point == null) {
+                       if (!has_c_files && context.entry_point == null) {
                                Report.error (null, "program does not contain a static `main' method");
                        }
                }