mescc: Tinycc support: sizeof ("foo").

* module/language/c99/compiler.mes (expr->accu): Support sizeof (string).
This commit is contained in:
Jan Nieuwenhuizen 2017-07-23 13:56:38 +02:00
parent ce3233f998
commit 1c01a65d8b

View file

@ -518,6 +518,9 @@
(size (ast-type->size info type))) (size (ast-type->size info type)))
(append-text info (wrap-as (i386:value->accu size))))) (append-text info (wrap-as (i386:value->accu size)))))
((sizeof-expr (p-expr (string ,string)))
(append-text info (wrap-as (i386:value->accu (1+ (string-length string))))))
((sizeof-expr (i-sel (ident ,field) (p-expr (ident ,array)))) ((sizeof-expr (i-sel (ident ,field) (p-expr (ident ,array))))
(let* ((type (ident->type info array)) (let* ((type (ident->type info array))
(size (field-size info type field))) (size (field-size info type field)))