Skip to content

Commit ae349ca

Browse files
authored
cgen: fix all -Wmissing-variable-declarations (#5802)
1 parent 59df2db commit ae349ca

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

vlib/v/gen/cgen.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
786786
}
787787
ast.GlobalDecl {
788788
styp := g.typ(node.typ)
789-
g.definitions.writeln('$styp $node.name; // global')
789+
g.definitions.writeln('static $styp $node.name; // global')
790790
}
791791
ast.GoStmt {
792792
g.go_stmt(node)
@@ -2787,7 +2787,7 @@ fn (mut g Gen) const_decl(node ast.ConstDecl) {
27872787
}
27882788
}
27892789
ast.StringLiteral {
2790-
g.definitions.writeln('string _const_$name; // a string literal, inited later')
2790+
g.definitions.writeln('static string _const_$name; // a string literal, inited later')
27912791
if g.pref.build_mode != .build_module {
27922792
g.stringliterals.writeln('\t_const_$name = $val;')
27932793
}
@@ -2814,7 +2814,7 @@ fn (mut g Gen) const_decl_init_later(mod, name, val string, typ table.Type) {
28142814
styp := g.typ(typ)
28152815
//
28162816
cname := '_const_$name'
2817-
g.definitions.writeln('$styp $cname; // inited later')
2817+
g.definitions.writeln('static $styp $cname; // inited later')
28182818
g.inits[mod].writeln('\t$cname = $val;')
28192819
if g.pref.autofree {
28202820
if styp.starts_with('array_') {

vlib/v/gen/cheaders.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ $c_common_macros
208208
#endif
209209
210210
// g_live_info is used by live.info()
211-
void* g_live_info = NULL;
211+
static void* g_live_info = NULL;
212212
213213
//============================== HELPER C MACROS =============================*/
214214
//#define tos4(s, slen) ((string){.str=(s), .len=(slen)})
@@ -248,7 +248,7 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in
248248
249249
//================================== GLOBALS =================================*/
250250
//byte g_str_buf[1024];
251-
byte* g_str_buf;
251+
static byte* g_str_buf;
252252
int load_so(byteptr);
253253
void reload_so();
254254
void _vinit();

0 commit comments

Comments
 (0)