Skip to content

Commit 694cac9

Browse files
committed
ci,cgen: fix windows tests
1 parent 305c56d commit 694cac9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

vlib/v/gen/c/cgen.v

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,12 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) GenO
744744
extern_out_str := g.extern_out.str()
745745
b.write_string(out_str)
746746
b.writeln('// THE END.')
747-
b.write_string2('\n // V postincludes:\n', g.postincludes.str())
747+
748+
postincludes_str := g.postincludes.str()
749+
if postincludes_str != '' {
750+
b.write_string2('\n // V postincludes:\n', postincludes_str)
751+
}
752+
748753
util.timing_measure('cgen common')
749754
$if trace_all_generic_fn_keys ? {
750755
gkeys := g.table.fn_generic_types.keys()

vlib/v/gen/c/testdata/postinclude_header.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <assert.h>
22

3-
int main( void ) {
3+
#if defined(_WIN32)
4+
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPWSTR cmd_line, int show_cmd){
5+
#else
6+
int main(int argc, char *argv[]) {
7+
#endif
48
int res = no_main__f(42);
59
assert(res == 987);
610
return 0;

0 commit comments

Comments
 (0)