v2: fix version

pull/4192/head
Delyan Angelov 2020-04-02 11:48:29 +03:00 committed by GitHub
parent d57b1ca962
commit 12b8dc2613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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() {

View File

@ -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 = '