diff --git a/src/frontc/cabs.ml b/src/frontc/cabs.ml index 7a9db7b14..4ac432e04 100644 --- a/src/frontc/cabs.ml +++ b/src/frontc/cabs.ml @@ -168,7 +168,7 @@ and init_name = name * init_expression and single_name = specifier * name -and enum_item = string * expression * cabsloc +and enum_item = string * attribute list * expression * cabsloc (* ** Declaration definition (at toplevel) diff --git a/src/frontc/cabs2cil.ml b/src/frontc/cabs2cil.ml index 85dd9c092..686acb5e4 100644 --- a/src/frontc/cabs2cil.ml +++ b/src/frontc/cabs2cil.ml @@ -2675,7 +2675,7 @@ let rec doSpecList (suggestedAnonName: string) (* This string will be part of | [A.Tenum (n, Some eil, extraAttrs)] -> (* A definition of an enum *) let rec justNames eil = match eil with [] -> [] - | (str, expr, loc) :: eis -> str :: justNames eis + | (str, attrs, expr, loc) :: eis -> str :: justNames eis (* TODO: use attrs *) in let names = justNames eil in let n' = @@ -2736,11 +2736,11 @@ let rec doSpecList (suggestedAnonName: string) (* This string will be part of and loop i = function [] -> [] - | (kname, A.NOTHING, cloc) :: rest -> + | (kname, attrs, A.NOTHING, cloc) :: rest -> (* TODO: use attrs *) (* use the passed-in 'i' as the value, since none specified *) processName kname i (convLoc cloc) rest - | (kname, e, cloc) :: rest -> + | (kname, attrs, e, cloc) :: rest -> (* TODO: use attrs *) (* constant-eval 'e' to determine tag value *) let e' = getIntConstExp e in let e'' = diff --git a/src/frontc/cabsvisit.ml b/src/frontc/cabsvisit.ml index 85d44f933..6fc8dce74 100644 --- a/src/frontc/cabsvisit.ml +++ b/src/frontc/cabsvisit.ml @@ -198,9 +198,9 @@ and childrenTypeSpecifier vis ts = let fg' = mapNoCopy childrenFieldGroup fg in if fg' != fg then Tunion( n, Some fg', extraAttrs) else ts | Tenum (n, Some ei, extraAttrs) -> - let doOneEnumItem ((s, e, loc) as ei) = + let doOneEnumItem ((s, attrs, e, loc) as ei) = let e' = visitCabsExpression vis e in - if e' != e then (s, e', loc) else ei + if e' != e then (s, attrs, e', loc) else ei (* TODO: visit attrs? *) in vis#vEnterScope (); let ei' = mapNoCopy doOneEnumItem ei in diff --git a/src/frontc/cparser.mly b/src/frontc/cparser.mly index 4983a3c37..039162895 100644 --- a/src/frontc/cparser.mly +++ b/src/frontc/cparser.mly @@ -1188,8 +1188,8 @@ enum_list: /* (* ISO 6.7.2.2 *) */ | enum_list COMMA error { $1 } ; enumerator: - IDENT {(fst $1, NOTHING, snd $1)} -| IDENT EQ expression {(fst $1, fst $3, snd $1)} + IDENT attributes {(fst $1, $2, NOTHING, snd $1)} +| IDENT attributes EQ expression {(fst $1, $2, fst $4, snd $1)} ; diff --git a/src/frontc/cprint.ml b/src/frontc/cprint.ml index 2ea32fce6..4194cb051 100644 --- a/src/frontc/cprint.ml +++ b/src/frontc/cprint.ml @@ -262,10 +262,11 @@ and print_enum_items items = indent (); print_commas true - (fun (id, exp, loc) -> print id; + (fun (id, attrs, exp, loc) -> print id; if exp = NOTHING then () else begin space (); + print_attributes attrs; print "= "; print_expression exp end)