mescc: Opt for reproducible builds with Guile and Mes.

* module/mescc/compile.scm (mes-or-reproducible?): New variable.
(ast->comment): Use it.
* module/mescc/preprocess.scm (mes-or-reproducible?): New variable.
(c99-input->full-ast): Use it.
This commit is contained in:
Jan Nieuwenhuizen 2019-12-12 12:04:15 +01:00
parent 720f224a08
commit 36b2857d5b
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 6 additions and 3 deletions

View file

@ -42,6 +42,7 @@
c99-input->object))
(define mes? (pair? (current-module)))
(define mes-or-reproducible? #t)
(define (cc-amd? info) #f) ; use AMD calling convention?
;; (define %reduced-register-count #f) ; use all registers?
(define %reduced-register-count 2) ; use reduced instruction set
@ -581,7 +582,7 @@
(wrap-as `((#:comment ,o))))
(define (ast->comment o)
(if mes? '()
(if mes-or-reproducible? '()
(let* ((source (with-output-to-string (lambda () (pretty-print-c99 o))))
;; Nyacc fixups
(source (string-substitute source "\\" "\\\\"))
@ -1514,7 +1515,7 @@
info))
((or ,a ,b)
(let* ((here (number->string (length (if mes? (.text info)
(let* ((here (number->string (length (if mes-or-reproducible? (.text info)
(filter (negate comment?) (.text info))))))
(skip-b-label (string-append label "_skip_b_" here))
(b-label (string-append label "_b_" here))

View file

@ -31,6 +31,8 @@
#:use-module (mes guile)
#:export (c99-input->ast))
(define mes-or-reproducible? #t)
(when (getenv "MESC_DEBUG")
(format (current-error-port) "*nyacc-version*=~a\n" *nyacc-version*))
@ -97,7 +99,7 @@
"SYSTEM_LIBC=0"
"__STDC__=1"
"__MESC__=1"
,(if mes? "__MESC_MES__=1" "__MESC_MES__=0")
,(if mes-or-reproducible? "__MESC_MES__=1" "__MESC_MES__=0")
,@defines)))
(when (and verbose? (> verbose? 1))
(stderr "includes: ~s\n" includes)