@@ -56,25 +56,78 @@ def test_variables(self):
56
56
declarations .const_t ,
57
57
declarations .long_unsigned_int_t )
58
58
59
- static_var = initialized = self .global_ns .variable (name = 'static_var' )
59
+ m_mutable = self .global_ns .variable (name = "m_mutable" )
60
+ self .assertFalse (
61
+ m_mutable .type_qualifiers .has_static ,
62
+ "m_mutable must not have static type qualifier" )
63
+
64
+ if "GCC-XML" in utils .xml_generator :
65
+ # Old GCC-XML behaviour. Can be dropped once GCC-XML is removed.
66
+ static_var = self .global_ns .variable (name = "extern_var" )
67
+ self .assertTrue (
68
+ static_var .type_qualifiers .has_static ,
69
+ "static_var must have static type qualifier" )
70
+ self .assertFalse (
71
+ static_var .type_qualifiers .has_mutable ,
72
+ "static_var must not have mutable type qualifier" )
73
+ return
74
+
75
+ # CastXML only tests --------------
76
+
77
+ self .assertTrue (
78
+ m_mutable .type_qualifiers .has_mutable ,
79
+ "m_mutable must have mutable type qualifier" )
80
+
81
+ # External static variable
82
+ extern_var = self .global_ns .variable (name = "extern_var" )
83
+ self .assertTrue (
84
+ extern_var .type_qualifiers .has_extern ,
85
+ "extern_var must have extern type qualifier" )
86
+ self .assertFalse (
87
+ extern_var .type_qualifiers .has_static ,
88
+ "extern_var must not have a static type qualifier" )
89
+ self .assertFalse (
90
+ extern_var .type_qualifiers .has_mutable ,
91
+ "static_var must not have mutable type qualifier" )
92
+
93
+ # Static variable
94
+ static_var = self .global_ns .variable (name = "static_var" )
60
95
self .assertTrue (
61
96
static_var .type_qualifiers .has_static ,
62
97
"static_var must have static type qualifier" )
63
- self .assertTrue (
64
- not static_var .type_qualifiers .has_mutable ,
98
+ self .assertFalse (
99
+ static_var .type_qualifiers .has_extern ,
100
+ "static_var must not have an extern type qualifier" )
101
+ self .assertFalse (
102
+ static_var .type_qualifiers .has_mutable ,
65
103
"static_var must not have mutable type qualifier" )
66
104
105
+ ssv_static_var = self .global_ns .variable (name = "ssv_static_var" )
106
+ self .assertTrue (
107
+ ssv_static_var .type_qualifiers .has_static ,
108
+ "ssv_static_var must have static type qualifier" )
109
+ self .assertFalse (
110
+ ssv_static_var .type_qualifiers .has_extern ,
111
+ "ssv_static_var must not have an extern type qualifier" )
112
+ self .assertFalse (
113
+ ssv_static_var .type_qualifiers .has_mutable ,
114
+ "ssv_static_var must not have mutable type qualifier" )
115
+
116
+ ssv_static_var_value = self .global_ns .variable (
117
+ name = "ssv_static_var_value" )
118
+ self .assertTrue (
119
+ ssv_static_var_value .type_qualifiers .has_static ,
120
+ "ssv_static_var_value must have static type qualifier" )
121
+ self .assertFalse (
122
+ ssv_static_var_value .type_qualifiers .has_extern ,
123
+ "ssv_static_var_value must not have an extern type qualifier" )
124
+ self .assertFalse (
125
+ ssv_static_var_value .type_qualifiers .has_mutable ,
126
+ "ssv_static_var_value must not have mutable type qualifier" )
127
+
67
128
if 'PDB' in utils .xml_generator :
68
129
return # TODO find out work around
69
130
70
- m_mutable = initialized = self .global_ns .variable (name = 'm_mutable' )
71
- self .assertTrue (
72
- not m_mutable .type_qualifiers .has_static ,
73
- "m_mutable must not have static type qualifier" )
74
- # TODO: "There is bug in GCCXML: doesn't write mutable qualifier."
75
- # self.assertTrue( m_mutable.type_qualifiers.has_mutable
76
- # , "static_var must have mutable type qualifier" )
77
-
78
131
def test_calldef_free_functions (self ):
79
132
ns = self .global_ns .namespace ('calldef' )
80
133
0 commit comments