File tree 4 files changed +32
-2
lines changed
regression/cpp/gcc_attributes2
4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change
1
+ #ifdef __GNUC__
2
+ typedef int my_int16_t __attribute__ ((__mode__(__HI__)));
3
+ static_assert (sizeof (my_int16_t ) == 2, "16 bit");
4
+ #endif
5
+
6
+ int main ()
7
+ {
8
+ return 0 ;
9
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.cpp
3
+ -std=c++11
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^warning: ignoring
8
+ ^CONVERSION ERROR$
Original file line number Diff line number Diff line change @@ -272,6 +272,10 @@ void cpp_typecheckt::typecheck_type(typet &type)
272
272
{
273
273
c_typecheck_baset::typecheck_type (type);
274
274
}
275
+ else if (type.id () == ID_gcc_attribute_mode)
276
+ {
277
+ c_typecheck_baset::typecheck_type (type);
278
+ }
275
279
else
276
280
{
277
281
error ().source_location =type.source_location ();
Original file line number Diff line number Diff line change @@ -2262,7 +2262,7 @@ bool Parser::rAttribute(typet &t)
2262
2262
2263
2263
typet attr (ID_gcc_attribute_mode);
2264
2264
set_location (attr, tk);
2265
- attr.set (ID_size, name. get (ID_identifier ));
2265
+ attr.set (ID_size, to_cpp_name ( name). get_base_name ( ));
2266
2266
merge_types (attr, t);
2267
2267
break ;
2268
2268
}
@@ -2880,7 +2880,7 @@ bool Parser::rDeclaratorWithInit(
2880
2880
bit_field_type.subtype ().make_nil ();
2881
2881
set_location (bit_field_type, tk);
2882
2882
2883
- // merge_types(bit_field_type, declarator .type());
2883
+ merge_types (bit_field_type, dw .type ());
2884
2884
2885
2885
return true ;
2886
2886
}
@@ -3226,6 +3226,15 @@ bool Parser::rDeclarator(
3226
3226
}
3227
3227
3228
3228
optCvQualify (d_outer);
3229
+ if (d_outer.is_not_nil () && !d_outer.has_subtypes ())
3230
+ {
3231
+ merged_typet merged_type;
3232
+ merged_type.move_to_subtypes (d_outer);
3233
+ typet nil;
3234
+ nil.make_nil ();
3235
+ merged_type.move_to_sub (nil);
3236
+ d_outer.swap (merged_type);
3237
+ }
3229
3238
3230
3239
#ifdef DEBUG
3231
3240
std::cout << std::string (__indent, ' ' ) << " Parser::rDeclarator2 13\n " ;
You can’t perform that action at this time.
0 commit comments