mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
a fix to generated C header global
test:
```c3
module my_module;
alias Something = fn void(int);
Something something @export("something") = &something_else;
fn void something_else(int a) => {};
```
would generate
```c
/* GLOBALS */
my_module__Somethingextern something;
```
now correctly generates
```c
/* GLOBALS */
extern my_module__Something something;
```
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
This commit is contained in:
committed by
Christoffer Lerno
parent
c73c7cb2a3
commit
9d54e9e3c4
@@ -676,10 +676,10 @@ static void header_gen_global_var(HeaderContext *c, Decl *decl, bool fn_globals,
|
||||
header_gen_maybe_generate_type(c, decl->type, false);
|
||||
return;
|
||||
}
|
||||
header_print_type(c, decl->type);
|
||||
ASSERT(decl->var.kind == VARDECL_GLOBAL || decl->var.kind == VARDECL_CONST);
|
||||
PRINTF("extern ");
|
||||
if (decl->var.kind == VARDECL_CONST) PRINTF("const ");
|
||||
header_print_type(c, decl->type);
|
||||
PRINTF(" %s;\n", decl_get_extname(decl));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user