summaryrefslogtreecommitdiff
path: root/cfrontend/PrintCsyntax.ml
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-26 10:41:07 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-26 10:41:07 +0000
commit2570ddd61b1c98b62c8d97fce862654535696844 (patch)
treee9a652b115045a3b2c4ade69ec3cc3fdad429b54 /cfrontend/PrintCsyntax.ml
parent65cc3738e7436e46f70c0508638a71fbb49c50a8 (diff)
- Support for _Alignof(ty) operator from ISO C 2011
and __alignof__(ty), __alignof__(expr) from GCC. - Resurrected __builtin_memcpy_aligned, useful for files generated by Scade KCG 6. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1827 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cfrontend/PrintCsyntax.ml')
-rw-r--r--cfrontend/PrintCsyntax.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/cfrontend/PrintCsyntax.ml b/cfrontend/PrintCsyntax.ml
index 804b018..0616049 100644
--- a/cfrontend/PrintCsyntax.ml
+++ b/cfrontend/PrintCsyntax.ml
@@ -145,6 +145,7 @@ let rec precedence = function
| Eval _ -> (16, NA)
| Evalof(l, _) -> precedence l
| Esizeof _ -> (15, RtoL)
+ | Ealignof _ -> (15, RtoL)
| Ecall _ -> (16, LtoR)
| Epostincr _ -> (16, LtoR)
| Eunop _ -> (15, RtoL)
@@ -196,6 +197,8 @@ let rec expr p (prec, e) =
fprintf p "<undef>"
| Esizeof(ty, _) ->
fprintf p "sizeof(%s)" (name_type ty)
+ | Ealignof(ty, _) ->
+ fprintf p "__alignof__(%s)" (name_type ty)
| Eunop(op, a1, _) ->
fprintf p "%s%a" (name_unop op) expr (prec', a1)
| Eaddrof(a1, _) ->
@@ -444,7 +447,8 @@ let rec collect_expr = function
| Ecast(r, _) -> collect_expr r
| Econdition(r1, r2, r3, _) ->
collect_expr r1; collect_expr r2; collect_expr r3
- | Esizeof _ -> ()
+ | Esizeof(ty, _) -> collect_type ty
+ | Ealignof(ty, _) -> collect_type ty
| Eassign(l, r, _) -> collect_expr l; collect_expr r
| Eassignop(_, l, r, _, _) -> collect_expr l; collect_expr r
| Epostincr(_, l, _) -> collect_expr l