Skip to content

Commit

Permalink
all: finish bootstrapping of @VCURRENTHASH (#19517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spydr06 committed Oct 7, 2023
1 parent fe41bda commit 8023e25
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
4 changes: 2 additions & 2 deletions vlib/builtin/builtin.c.v
Expand Up @@ -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
Expand Down Expand Up @@ -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 ? {
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/checker/checker.v
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions vlib/v/gen/c/cgen.v
Expand Up @@ -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() {
Expand Down
7 changes: 0 additions & 7 deletions vlib/v/gen/c/cheaders.v
Expand Up @@ -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 {
Expand Down
9 changes: 2 additions & 7 deletions vlib/v/util/version/version.v
Expand Up @@ -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
}

0 comments on commit 8023e25

Please sign in to comment.