diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2021-08-22 13:29:36 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2021-08-22 13:29:36 +0200 |
commit | d2595e3afb8c38a3391a66c3fc3f7a92fff9eff4 (patch) | |
tree | f3c8fba9ffffee5924dadd803fcebdc3520c9361 /cparser/PackedStructs.ml | |
parent | d97caa16d15b0faca8386a060ec2bfaedad3cdab (diff) | |
parent | 47fae389c800034e002c9f8a398e9adc79a14b81 (diff) | |
download | compcert-d2595e3afb8c38a3391a66c3fc3f7a92fff9eff4.tar.gz compcert-d2595e3afb8c38a3391a66c3fc3f7a92fff9eff4.zip |
Merge branch 'bitfields' (#400)
Diffstat (limited to 'cparser/PackedStructs.ml')
-rw-r--r-- | cparser/PackedStructs.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cparser/PackedStructs.ml b/cparser/PackedStructs.ml index 6bea4b92..f3a45785 100644 --- a/cparser/PackedStructs.ml +++ b/cparser/PackedStructs.ml @@ -61,10 +61,10 @@ let set_alignas_attr al attrs = (* Rewriting field declarations *) let transf_field_decl mfa swapped loc env struct_id f = - if f.fld_bitfield <> None then - error loc "bitfields in packed structs not allowed"; (* Register as byte-swapped if needed *) if swapped then begin + if f.fld_bitfield <> None then + error loc "byte-swapped bit fields are not supported"; let (can_swap, must_swap) = can_byte_swap env f.fld_typ in if not can_swap then fatal_error loc "cannot byte-swap field of type '%a'" @@ -74,6 +74,8 @@ let transf_field_decl mfa swapped loc env struct_id f = end; (* Reduce alignment if requested *) if mfa = 0 then f else begin + if f.fld_bitfield <> None then + error loc "bit fields in packed structs are not supported"; let al = safe_alignof loc env f.fld_typ in { f with fld_typ = change_attributes_type env (set_alignas_attr (min mfa al)) f.fld_typ } |