@@ -590,6 +590,8 @@ const char* variable_attribute_to_string (gcc_jit_variable_attribute attr)
590
590
{
591
591
case GCC_JIT_VARIABLE_ATTRIBUTE_VISIBILITY:
592
592
return " visibility" ;
593
+ case GCC_JIT_VARIABLE_ATTRIBUTE_WEAK:
594
+ return " weak" ;
593
595
case GCC_JIT_VARIABLE_ATTRIBUTE_MAX:
594
596
return NULL ;
595
597
}
@@ -775,7 +777,8 @@ global_new_decl (location *loc,
775
777
const char *name,
776
778
enum global_var_flags flags,
777
779
const std::vector<std::pair<gcc_jit_variable_attribute,
778
- std::string>> &attributes,
780
+ std::string>> &string_attributes,
781
+ const std::vector<gcc_jit_variable_attribute> &attributes,
779
782
bool readonly,
780
783
bool removed)
781
784
{
@@ -831,7 +834,19 @@ global_new_decl (location *loc,
831
834
if (loc)
832
835
set_tree_location (inner, loc);
833
836
834
- set_variable_string_attribute (attributes, inner);
837
+ set_variable_string_attribute (string_attributes, inner);
838
+
839
+ tree var_attributes = NULL_TREE;
840
+ for (auto attr: attributes)
841
+ {
842
+ const char * attribute = variable_attribute_to_string (attr);
843
+ if (attribute)
844
+ {
845
+ tree ident = get_identifier (attribute);
846
+ var_attributes = tree_cons (ident, NULL_TREE, var_attributes);
847
+ }
848
+ }
849
+ decl_attributes (&inner, var_attributes, 0 );
835
850
836
851
return inner;
837
852
}
@@ -879,12 +894,14 @@ new_global (location *loc,
879
894
const char *name,
880
895
enum global_var_flags flags,
881
896
const std::vector<std::pair<gcc_jit_variable_attribute,
882
- std::string>> &attributes,
897
+ std::string>> &string_attributes,
898
+ const std::vector<gcc_jit_variable_attribute> &attributes,
883
899
bool readonly,
884
900
bool removed)
885
901
{
886
902
tree inner =
887
- global_new_decl (loc, kind, type, name, flags, attributes, readonly, removed);
903
+ global_new_decl (loc, kind, type, name, flags, string_attributes,
904
+ attributes, readonly, removed);
888
905
889
906
return global_finalize_lvalue (inner, removed);
890
907
}
@@ -1031,11 +1048,14 @@ new_global_initialized (location *loc,
1031
1048
const char *name,
1032
1049
enum global_var_flags flags,
1033
1050
const std::vector<std::pair<gcc_jit_variable_attribute,
1034
- std::string>> &attributes,
1051
+ std::string>> &string_attributes,
1052
+ const std::vector<gcc_jit_variable_attribute>
1053
+ &attributes,
1035
1054
bool readonly,
1036
1055
bool removed)
1037
1056
{
1038
- tree inner = global_new_decl (loc, kind, type, name, flags, attributes, readonly, removed);
1057
+ tree inner = global_new_decl (loc, kind, type, name, flags,
1058
+ string_attributes, attributes, readonly, removed);
1039
1059
1040
1060
vec<constructor_elt, va_gc> *constructor_elements = NULL ;
1041
1061
0 commit comments