From 1aeb7823e82a7cfc9380aa1d7bc2df3478a53363 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sat, 7 Mar 2020 22:16:32 +0100 Subject: [PATCH] cmp: add explicit type suffixes for emitted integer constants in C code According to the C99 standard, compilers are supposed to automatically choose the correct type. However, for the C89 standard explicit suffixes are needed for long longs. Guess what standard msvc follows... --- src/cmp/cmpc-wt.lsp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cmp/cmpc-wt.lsp b/src/cmp/cmpc-wt.lsp index 77f2143bb..2f5f4063c 100644 --- a/src/cmp/cmpc-wt.lsp +++ b/src/cmp/cmpc-wt.lsp @@ -19,7 +19,18 @@ (defun wt1 (form) (cond ((not (floatp form)) (typecase form - ((or STRING INTEGER CHARACTER) + (INTEGER + (princ form *compiler-output1*) + (princ + (cond ((typep form (rep-type->lisp-type :int)) "") + ((typep form (rep-type->lisp-type :unsigned-int)) "U") + ((typep form (rep-type->lisp-type :long)) "L") + ((typep form (rep-type->lisp-type :unsigned-long)) "UL") + ((typep form (rep-type->lisp-type :long-long)) "LL") + ((typep form (rep-type->lisp-type :unsigned-long-long)) "ULL") + (t (baboon :format-control "wt1: The number ~A doesn't fit any integer type." form))) + *compiler-output1*)) + ((or STRING CHARACTER) (princ form *compiler-output1*)) (VAR (wt-var form)) (t (wt-loc form))))