@@ -232,43 +232,25 @@ void c_typecheck_baset::do_initializer(symbolt &symbol)
232232 if (has_prefix (id2string (symbol.name ), CPROVER_PREFIX " constant_infinity" ))
233233 return ;
234234
235- if (symbol.is_static_lifetime )
236- {
237- if (symbol.value .is_not_nil ())
238- {
239- typecheck_expr (symbol.value );
240- do_initializer (symbol.value , symbol.type , true );
235+ if (symbol.is_type )
236+ return ;
241237
242- // need to adjust size?
243- if (
244- symbol.type .id () == ID_array &&
245- to_array_type (symbol.type ).size ().is_nil ())
246- symbol.type =symbol.value .type ();
247- }
248- }
249- else if (!symbol.is_type )
238+ if (symbol.value .is_not_nil ())
250239 {
251- if (symbol.is_macro )
252- {
253- // these must have a constant value
254- assert (symbol.value .is_not_nil ());
255- typecheck_expr (symbol.value );
256- source_locationt location=symbol.value .source_location ();
257- do_initializer (symbol.value , symbol.type , true );
258- make_constant (symbol.value );
259- }
260- else if (symbol.value .is_not_nil ())
261- {
262- typecheck_expr (symbol.value );
263- do_initializer (symbol.value , symbol.type , true );
240+ typecheck_expr (symbol.value );
241+ do_initializer (symbol.value , symbol.type , true );
264242
265- // need to adjust size?
266- if (
267- symbol.type .id () == ID_array &&
268- to_array_type (symbol.type ).size ().is_nil ())
269- symbol.type =symbol.value .type ();
243+ // need to adjust size?
244+ if (
245+ !symbol.is_macro && symbol.type .id () == ID_array &&
246+ to_array_type (symbol.type ).size ().is_nil ())
247+ {
248+ symbol.type = symbol.value .type ();
270249 }
271250 }
251+
252+ if (symbol.is_macro )
253+ make_constant (symbol.value );
272254}
273255
274256void c_typecheck_baset::designator_enter (
0 commit comments