@@ -595,6 +595,8 @@ const char* variable_attribute_to_string (gcc_jit_variable_attribute attr)
595
595
{
596
596
case GCC_JIT_VARIABLE_ATTRIBUTE_VISIBILITY:
597
597
return " visibility" ;
598
+ case GCC_JIT_VARIABLE_ATTRIBUTE_WEAK:
599
+ return " weak" ;
598
600
case GCC_JIT_VARIABLE_ATTRIBUTE_MAX:
599
601
return NULL ;
600
602
}
@@ -780,7 +782,8 @@ global_new_decl (location *loc,
780
782
const char *name,
781
783
enum global_var_flags flags,
782
784
const std::vector<std::pair<gcc_jit_variable_attribute,
783
- std::string>> &attributes,
785
+ std::string>> &string_attributes,
786
+ const std::vector<gcc_jit_variable_attribute> &attributes,
784
787
bool readonly)
785
788
{
786
789
gcc_assert (type);
@@ -826,7 +829,19 @@ global_new_decl (location *loc,
826
829
if (loc)
827
830
set_tree_location (inner, loc);
828
831
829
- set_variable_string_attribute (attributes, inner);
832
+ set_variable_string_attribute (string_attributes, inner);
833
+
834
+ tree var_attributes = NULL_TREE;
835
+ for (auto attr: attributes)
836
+ {
837
+ const char * attribute = variable_attribute_to_string (attr);
838
+ if (attribute)
839
+ {
840
+ tree ident = get_identifier (attribute);
841
+ var_attributes = tree_cons (ident, NULL_TREE, var_attributes);
842
+ }
843
+ }
844
+ decl_attributes (&inner, var_attributes, 0 );
830
845
831
846
return inner;
832
847
}
@@ -873,11 +888,13 @@ new_global (location *loc,
873
888
const char *name,
874
889
enum global_var_flags flags,
875
890
const std::vector<std::pair<gcc_jit_variable_attribute,
876
- std::string>> &attributes,
891
+ std::string>> &string_attributes,
892
+ const std::vector<gcc_jit_variable_attribute> &attributes,
877
893
bool readonly)
878
894
{
879
895
tree inner =
880
- global_new_decl (loc, kind, type, name, flags, attributes, readonly);
896
+ global_new_decl (loc, kind, type, name, flags, string_attributes,
897
+ attributes, readonly);
881
898
882
899
return global_finalize_lvalue (inner);
883
900
}
@@ -1024,10 +1041,13 @@ new_global_initialized (location *loc,
1024
1041
const char *name,
1025
1042
enum global_var_flags flags,
1026
1043
const std::vector<std::pair<gcc_jit_variable_attribute,
1027
- std::string>> &attributes,
1044
+ std::string>> &string_attributes,
1045
+ const std::vector<gcc_jit_variable_attribute>
1046
+ &attributes,
1028
1047
bool readonly)
1029
1048
{
1030
- tree inner = global_new_decl (loc, kind, type, name, flags, attributes, readonly);
1049
+ tree inner = global_new_decl (loc, kind, type, name, flags,
1050
+ string_attributes, attributes, readonly);
1031
1051
1032
1052
vec<constructor_elt, va_gc> *constructor_elements = NULL ;
1033
1053
0 commit comments