1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix all -Wmissing-variable-declarations (#5802)

This commit is contained in:
ka-weihe 2020-07-11 15:37:40 +02:00 committed by GitHub
parent 59df2db4e0
commit ae349ca6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -786,7 +786,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
} }
ast.GlobalDecl { ast.GlobalDecl {
styp := g.typ(node.typ) styp := g.typ(node.typ)
g.definitions.writeln('$styp $node.name; // global') g.definitions.writeln('static $styp $node.name; // global')
} }
ast.GoStmt { ast.GoStmt {
g.go_stmt(node) g.go_stmt(node)
@ -2787,7 +2787,7 @@ fn (mut g Gen) const_decl(node ast.ConstDecl) {
} }
} }
ast.StringLiteral { ast.StringLiteral {
g.definitions.writeln('string _const_$name; // a string literal, inited later') g.definitions.writeln('static string _const_$name; // a string literal, inited later')
if g.pref.build_mode != .build_module { if g.pref.build_mode != .build_module {
g.stringliterals.writeln('\t_const_$name = $val;') g.stringliterals.writeln('\t_const_$name = $val;')
} }
@ -2814,7 +2814,7 @@ fn (mut g Gen) const_decl_init_later(mod, name, val string, typ table.Type) {
styp := g.typ(typ) styp := g.typ(typ)
// //
cname := '_const_$name' cname := '_const_$name'
g.definitions.writeln('$styp $cname; // inited later') g.definitions.writeln('static $styp $cname; // inited later')
g.inits[mod].writeln('\t$cname = $val;') g.inits[mod].writeln('\t$cname = $val;')
if g.pref.autofree { if g.pref.autofree {
if styp.starts_with('array_') { if styp.starts_with('array_') {

View File

@ -208,7 +208,7 @@ $c_common_macros
#endif #endif
// g_live_info is used by live.info() // g_live_info is used by live.info()
void* g_live_info = NULL; static void* g_live_info = NULL;
//============================== HELPER C MACROS =============================*/ //============================== HELPER C MACROS =============================*/
//#define tos4(s, slen) ((string){.str=(s), .len=(slen)}) //#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
//================================== GLOBALS =================================*/ //================================== GLOBALS =================================*/
//byte g_str_buf[1024]; //byte g_str_buf[1024];
byte* g_str_buf; static byte* g_str_buf;
int load_so(byteptr); int load_so(byteptr);
void reload_so(); void reload_so();
void _vinit(); void _vinit();