Remove @(static) for global variables

This commit is contained in:
gingerBill
2021-05-19 11:51:48 +01:00
parent b34e4a9fd1
commit 26ce40c188
5 changed files with 6 additions and 17 deletions
+2 -2
View File
@@ -6,9 +6,9 @@ Rand :: struct {
} }
@(private, static) @(private)
_GLOBAL_SEED_DATA := 1234567890; _GLOBAL_SEED_DATA := 1234567890;
@(private, static) @(private)
global_rand := create(u64(uintptr(&_GLOBAL_SEED_DATA))); global_rand := create(u64(uintptr(&_GLOBAL_SEED_DATA)));
set_global_seed :: proc(seed: u64) { set_global_seed :: proc(seed: u64) {
+1 -1
View File
@@ -221,7 +221,7 @@ pop_rune :: proc(b: ^Builder) -> (r: rune, width: int) {
} }
@(private, static) @(private)
DIGITS_LOWER := "0123456789abcdefx"; DIGITS_LOWER := "0123456789abcdefx";
write_quoted_string :: proc{ write_quoted_string :: proc{
-10
View File
@@ -12,7 +12,6 @@ package unicode
@(private) pLo :: pLl | pLu; // a letter that is neither upper nor lower case. @(private) pLo :: pLl | pLu; // a letter that is neither upper nor lower case.
@(private) pLmask :: pLo; @(private) pLmask :: pLo;
@(static)
char_properties := [MAX_LATIN1+1]u8{ char_properties := [MAX_LATIN1+1]u8{
0x00 = pC, // '\x00' 0x00 = pC, // '\x00'
0x01 = pC, // '\x01' 0x01 = pC, // '\x01'
@@ -273,7 +272,6 @@ char_properties := [MAX_LATIN1+1]u8{
}; };
@(static)
alpha_ranges := [?]i32{ alpha_ranges := [?]i32{
0x00d8, 0x00f6, 0x00d8, 0x00f6,
0x00f8, 0x01f5, 0x00f8, 0x01f5,
@@ -429,7 +427,6 @@ alpha_ranges := [?]i32{
0xffda, 0xffdc, 0xffda, 0xffdc,
}; };
@(static)
alpha_singlets := [?]i32{ alpha_singlets := [?]i32{
0x00aa, 0x00aa,
0x00b5, 0x00b5,
@@ -465,7 +462,6 @@ alpha_singlets := [?]i32{
0xfe74, 0xfe74,
}; };
@(static)
space_ranges := [?]i32{ space_ranges := [?]i32{
0x0009, 0x000d, // tab and newline 0x0009, 0x000d, // tab and newline
0x0020, 0x0020, // space 0x0020, 0x0020, // space
@@ -481,7 +477,6 @@ space_ranges := [?]i32{
0xfeff, 0xfeff, 0xfeff, 0xfeff,
}; };
@(static)
unicode_spaces := [?]i32{ unicode_spaces := [?]i32{
0x0009, // tab 0x0009, // tab
0x000a, // LF 0x000a, // LF
@@ -499,7 +494,6 @@ unicode_spaces := [?]i32{
0xfeff, // unknown 0xfeff, // unknown
}; };
@(static)
to_upper_ranges := [?]i32{ to_upper_ranges := [?]i32{
0x0061, 0x007a, 468, // a-z A-Z 0x0061, 0x007a, 468, // a-z A-Z
0x00e0, 0x00f6, 468, 0x00e0, 0x00f6, 468,
@@ -538,7 +532,6 @@ to_upper_ranges := [?]i32{
0xff41, 0xff5a, 468, 0xff41, 0xff5a, 468,
}; };
@(static)
to_upper_singlets := [?]i32{ to_upper_singlets := [?]i32{
0x00ff, 621, 0x00ff, 621,
0x0101, 499, 0x0101, 499,
@@ -882,7 +875,6 @@ to_upper_singlets := [?]i32{
0x1ff3, 509, 0x1ff3, 509,
}; };
@(static)
to_lower_ranges := [?]i32{ to_lower_ranges := [?]i32{
0x0041, 0x005a, 532, // A-Z a-z 0x0041, 0x005a, 532, // A-Z a-z
0x00c0, 0x00d6, 532, // - - 0x00c0, 0x00d6, 532, // - -
@@ -922,7 +914,6 @@ to_lower_ranges := [?]i32{
0xff21, 0xff3a, 532, // - - 0xff21, 0xff3a, 532, // - -
}; };
@(static)
to_lower_singlets := [?]i32{ to_lower_singlets := [?]i32{
0x0100, 501, 0x0100, 501,
0x0102, 501, 0x0102, 501,
@@ -1259,7 +1250,6 @@ to_lower_singlets := [?]i32{
0x1ffc, 491, 0x1ffc, 491,
}; };
@(static)
to_title_singlets := [?]i32{ to_title_singlets := [?]i32{
0x01c4, 501, 0x01c4, 501,
0x01c6, 499, 0x01c6, 499,
+2 -3
View File
@@ -899,10 +899,9 @@ void check_global_variable_decl(CheckerContext *ctx, Entity *&e, Ast *type_expr,
e->Variable.thread_local_model = ac.thread_local_model; e->Variable.thread_local_model = ac.thread_local_model;
e->Variable.is_export = ac.is_export; e->Variable.is_export = ac.is_export;
e->flags &= ~EntityFlag_Static;
if (ac.is_static) { if (ac.is_static) {
e->flags |= EntityFlag_Static; error(e->token, "@(static) is not supported for global variables, nor required");
} else {
e->flags &= ~EntityFlag_Static;
} }
ac.link_name = handle_link_name(ctx, e->token, ac.link_name, ac.link_prefix); ac.link_name = handle_link_name(ctx, e->token, ac.link_name, ac.link_prefix);
+1 -1
View File
@@ -14910,7 +14910,7 @@ void lb_generate_code(lbGenerator *gen) {
LLVMMetadataRef llvm_file = lb_get_llvm_metadata(m, e->file); LLVMMetadataRef llvm_file = lb_get_llvm_metadata(m, e->file);
LLVMMetadataRef llvm_scope = llvm_file; LLVMMetadataRef llvm_scope = llvm_file;
LLVMBool local_to_unit = e->flags & EntityFlag_Static; LLVMBool local_to_unit = LLVMGetLinkage(g.value) == LLVMInternalLinkage;
LLVMMetadataRef llvm_expr = LLVMDIBuilderCreateExpression(m->debug_builder, nullptr, 0); LLVMMetadataRef llvm_expr = LLVMDIBuilderCreateExpression(m->debug_builder, nullptr, 0);
LLVMMetadataRef llvm_decl = nullptr; LLVMMetadataRef llvm_decl = nullptr;