aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-25 01:12:21 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-08-18 16:38:37 +0200
commitbe56bdcf3c82c2596186ec24ca0466d0fe6576eb (patch)
tree56876f3c514de4714c512cd9efcb7713b36bb4a7
parentMade pprint-environment differentiate between "public" and "private" macros. (diff)
downloadcalp-be56bdcf3c82c2596186ec24ca0466d0fe6576eb.tar.gz
calp-be56bdcf3c82c2596186ec24ca0466d0fe6576eb.tar.xz
Add more predefined macros mandated by the standard.
-rw-r--r--module/c/preprocessor2.scm12
1 files changed, 11 insertions, 1 deletions
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)))