From be56bdcf3c82c2596186ec24ca0466d0fe6576eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 25 Jul 2022 01:12:21 +0200 Subject: Add more predefined macros mandated by the standard. --- module/c/preprocessor2.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm index e63103dc..9cf94302 100644 --- a/module/c/preprocessor2.scm +++ b/module/c/preprocessor2.scm @@ -812,13 +812,23 @@ (define* (make-default-environment key: (now (localtime (current-time)))) (-> (string-append + ;; /* 6.10.8 Predefined macro names */ + ;; /* 6.10.8.1 Mandatory macros */ "#define __STDC__ 1\n" "#define __STDC_HOSTED__ 1\n" "#define __STDC_VERSION__ 201112L\n" ;; TODO format should always be in ;; english, and not tranlated (format #f "#define __DATE__ \"~a\"~%" (strftime "%b %_d %Y" now)) - (format #f "#define __TIME__ \"~a\"~%" (strftime "%H:%M:%S" now))) + (format #f "#define __TIME__ \"~a\"~%" (strftime "%H:%M:%S" now)) + + ;; /* 6.10.8.2 Environment macros */ + ;; /* 6.10.8.3 Conditional feature macros */ + "#define __STDC_NO_ATOMICS__ 1\n" + "#define __STDC_NO_COMPLEX__ 1\n" + "#define __STDC_NO_THREADS__ 1\n" + "#define __STDC_NO_VLA__ 1\n" + ) (preprocess-string (make-environment)) (value-ref 0))) -- cgit v1.2.3