Open Scope Z.
(************************************************  Definition of nested_field_type2, nested_field_offset2  The principle of this part is only exposing nft2 and nfo2 to users and hide the implimentation of nf_rec  ************************************************)
Inductive gfield : Type :=
| ArraySubsc : forall i: Z, gfield
| StructField : forall i: ident, gfield
| UnionField : forall i: ident, gfield.
Delimit Scope gfield_scope with gfield.
Bind Scope gfield_scope with list gfield.
Notation "x 'DOT' y " := (@cons gfield (StructField y) x%gfield) (at level 40, left associativity): gfield_scope.
Notation "x 'UDOT' y " := (@cons gfield (UnionField y) x%gfield) (at level 40, left associativity): gfield_scope.
Notation "x 'SUB' y " := (@cons gfield (ArraySubsc y) x%gfield) (at level 40, left associativity): gfield_scope.
Notation "'DOT' y " := (@cons gfield (StructField y) nil) (at level 40): gfield_scope.
Notation "'UDOT' y " := (@cons gfield (UnionField y) nil) (at level 40): gfield_scope.
Notation "'SUB' y " := (@cons gfield (ArraySubsc y) nil) (at level 40): gfield_scope.
(* Notation "Y @s X" := (cons (StructField X) Y) (at level 70). Notation "Y @u X" := (cons (UnionField X) Y) (at level 70). Notation "Y [ X ]" := (cons (ArraySubsc X) Y) (at level 70). *)
(* Notation "@@s X" := (cons (StructField X) nil) (at level 60). Notation "@@u X" := (cons (UnionField X) nil) (at level 60). Notation "[( X )]" := (cons (ArraySubsc X) nil) (at level 60). *)
Section COMPOSITE_ENV.
Context {cs: compspecs}.
Definition gfield_type t gf :=
match t, gf with
| Tarray t0 _ _, ArraySubsc _ => t0
| Tstruct id _, StructField i
| Tunion id _, UnionField i => field_type i (co_members (get_co id))
| _, _ => Tvoid
end.
Definition gfield_offset t gf :=
match t, gf with
| Tarray t0 _ _, ArraySubsc i => sizeof t0 * i
| Tstruct id _, StructField i => field_offset cenv_cs i (co_members (get_co id))
| Tunion id _, UnionField i => 0
| _, _ => 0
end.
Definition no_alignas_attr (a: attr): attr := mk_attr (attr_volatile a) None.

(* Specifications: *)
Lemma no_alignas_attr_spec: forall a d,
align_attr (no_alignas_attr a) d = d.