From ef4868eb13915ae5fbfdb5a1f94579af253bf528 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 21 Jul 2017 21:43:18 +0200 Subject: [PATCH] mescc: Tinycc support: ignore [ULL], UL, LL, L. * module/language/c99/compiler.mes (cstring->number): Drop suffix. --- module/language/c99/compiler.mes | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index 99cba7d9..68dfa585 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -1318,10 +1318,15 @@ (_ ((jump i386:jump-z (wrap-as (i386:accu-zero?))) o))))) (define (cstring->number s) - (cond ((string-prefix? "0x" s) (string->number (string-drop s 2) 16)) - ((string-prefix? "0b" s) (string->number (string-drop s 2) 2)) - ((string-prefix? "0" s) (string->number s 8)) - (else (string->number s)))) + (let ((s (cond ((string-suffix? "ULL" s) (string-drop-right s 3)) + ((string-suffix? "UL" s) (string-drop-right s 2)) + ((string-suffix? "LL" s) (string-drop-right s 2)) + ((string-suffix? "L" s) (string-drop-right s 1)) + (else s)))) + (cond ((string-prefix? "0x" s) (string->number (string-drop s 2) 16)) + ((string-prefix? "0b" s) (string->number (string-drop s 2) 2)) + ((string-prefix? "0" s) (string->number s 8)) + (else (string->number s))))) (define (struct-field info) (lambda (o)