force c89 pedantic compilation mode

This commit is contained in:
2025-08-21 18:15:48 +03:00
committed by Pavel Kulyov
parent 63918d23c0
commit d5e443a72c
2 changed files with 13 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
(include stdlib.h)
(include stddef.h)
(include stdbool.h)
(include stdio.h)
(chicken-import srfi-1 brev-separate) ; list routines, e.g. fold
@@ -16,7 +15,7 @@
((const char *) c)
((fn bool ((bool val))) not)))
(var foo f #((= .a-field 1.2)))
(var foo f)
(list-T int)
(make-list-T int #f)
@@ -26,7 +25,7 @@
(extern fn void puk ((int a) (float b)))
(fn int bar () (return ,(imports-test 10 20 30)))
(pub fn void baz () true)
(pub fn bool baz () (return true))
(extern var int i)
(var int j)
@@ -34,15 +33,15 @@
(pub fn int main ()
(var (* list-int) l (make-list-int))
(printf "Size of the list: %zu\n" (length-list-int l))
(printf "Size of the list: %lu\n" (length-list-int l))
(add-value-list-int l 3)
(add-value-list-int l 4)
(printf "Size of the list: %zu\n" (length-list-int l))
(printf "Size of the list: %lu\n" (length-list-int l))
(list-for-each list-int l int v
(printf "%d " v))
(printf "\n")
(printf "Size of the list: %zu\n" (length-list-int l))
(printf "%p\n" l->next)
(printf "Size of the list: %lu\n" (length-list-int l))
(printf "%p\n" (cast void* l->next))
(return 0))
(pub fn void print-list (((const list-int) *l))

View File

@@ -1,7 +1,8 @@
(declare (unit sexc)
(uses fmt-c
sex-macros
sex-modules))
sex-modules
sex-types))
(include "utils.macros.scm")
@@ -44,6 +45,10 @@
((@) 'vector-ref)
((include) '%include)
((cast) '%cast)
;; uh things we do for c89 compatibility
((bool) 'int)
((true) 1)
((false) 0)
(else
(if (symbol? atom)
(unkebabify atom)
@@ -288,7 +293,7 @@
(emit-c sex-forms)))
(call-with-values
(lambda ()
(process compiler (append (list temp-c-out "-o" out-file)
(process compiler (append (list temp-c-out "-o" out-file "-std=c89" "-pedantic")
(if (get-arg args 'compile-object #f)
(list "-c")
(list))