all: finish bootstrapping of @VCURRENTHASH (#19517)

This commit is contained in:
Spydr 2023-10-07 13:08:58 +02:00 committed by GitHub
parent fe41bda6f9
commit 8023e25bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 20 deletions

View File

@ -50,7 +50,7 @@ fn panic_debug(line_no int, file string, mod string, fn_name string, s string) {
eprintln(' function: ${fn_name}()')
eprintln(' message: ${s}')
eprintln(' file: ${file}:${line_no}')
eprintln(' v hash: ${@VHASH}') // TODO: use @VCURRENTHASH when bootstrapped
eprintln(' v hash: ${@VCURRENTHASH}')
eprintln('=========================================')
$if native {
C.exit(1) // TODO: native backtraces
@ -104,7 +104,7 @@ pub fn panic(s string) {
} $else {
eprint('V panic: ')
eprintln(s)
eprintln('v hash: ${@VHASH}') // TODO: use @VCURRENTHASH when bootstrapped
eprintln('v hash: ${@VCURRENTHASH}')
$if native {
C.exit(1) // TODO: native backtraces
} $else $if exit_after_panic_message ? {

View File

@ -135,7 +135,7 @@ mut:
fn_return_type ast.Type
orm_table_fields map[string][]ast.StructField // known table structs
//
v_current_commit_hash string // same as V_CURRENT_COMMIT_HASH
v_current_commit_hash string // same as old C.V_CURRENT_COMMIT_HASH
}
pub fn new_checker(table &ast.Table, pref_ &pref.Preferences) &Checker {

View File

@ -747,9 +747,7 @@ pub fn (mut g Gen) gen_file() {
}
pub fn (g &Gen) hashes() string {
mut res := c_commit_hash_default.replace('@@@', version.vhash())
res += c_current_commit_hash_default.replace('@@@', version.githash(g.pref.building_v))
return res
return c_commit_hash_default.replace('@@@', version.vhash())
}
pub fn (mut g Gen) init() {

View File

@ -14,13 +14,6 @@ const c_commit_hash_default = '
#endif
'
// V_CURRENT_COMMIT_HASH is updated, when V is rebuilt inside a git repo.
const c_current_commit_hash_default = '
#ifndef V_CURRENT_COMMIT_HASH
#define V_CURRENT_COMMIT_HASH "@@@"
#endif
'
const c_concurrency_helpers = '
typedef struct __shared_map __shared_map;
struct __shared_map {

View File

@ -75,11 +75,6 @@ pub fn githash(should_get_from_filesystem bool) string {
}
break
}
mut buf := [50]u8{}
buf[0] = 0
unsafe {
bp := &buf[0]
C.snprintf(&char(bp), 50, c'%s', C.V_CURRENT_COMMIT_HASH)
return tos_clone(bp)
}
return @VCURRENTHASH
}