From 12b8dc2613f63439e89a0ccd45d02c7f7f49082f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 2 Apr 2020 11:48:29 +0300 Subject: [PATCH] v2: fix version --- vlib/v/gen/cgen.v | 2 +- vlib/v/gen/cheaders.v | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index b16007fc58..e0b4c7bc8b 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -98,7 +98,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string if g.is_test { g.write_tests_main() } - return g.typedefs.str() + g.definitions.str() + g.out.str() + return c_commit_hash_default + g.typedefs.str() + g.definitions.str() + g.out.str() } pub fn (g mut Gen) init() { diff --git a/vlib/v/gen/cheaders.v b/vlib/v/gen/cheaders.v index 5f26c160d9..298f750a73 100644 --- a/vlib/v/gen/cheaders.v +++ b/vlib/v/gen/cheaders.v @@ -1,8 +1,13 @@ module gen const ( - c_common_macros = ' + c_commit_hash_default = ' +#ifndef V_COMMIT_HASH +#define V_COMMIT_HASH "$vhash()" +#endif +' + c_common_macros = ' #define EMPTY_STRUCT_DECLARATION #define EMPTY_STRUCT_INITIALIZATION 0 // Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is... @@ -40,8 +45,6 @@ const ( #endif #endif -#define V_COMMIT_HASH "TODO" - ' c_headers = '