aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/PackedStructs.ml
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-24 14:51:15 +0200
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-24 14:51:15 +0200
commite49318b3606d7568d8592887e4278efa696afd10 (patch)
tree99a9a1b883e1db3a4f56e1b5046453817827ceef /cparser/PackedStructs.ml
parent2789e6179af061381f5b18a268adb562b28bcb8e (diff)
parentc34d25e011402aedad62b3fe9b7b04989df4522e (diff)
downloadcompcert-kvx-e49318b3606d7568d8592887e4278efa696afd10.tar.gz
compcert-kvx-e49318b3606d7568d8592887e4278efa696afd10.zip
Merge branch 'master' of https://github.com/AbsInt/CompCert into towards_3.10
Diffstat (limited to 'cparser/PackedStructs.ml')
-rw-r--r--cparser/PackedStructs.ml6
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 }