start a global from braces, not a compound literal
All checks were successful
Sex CI / build-linux (pull_request) Successful in 5m42s
All checks were successful
Sex CI / build-linux (pull_request) Successful in 5m42s
A compound literal is no constant in C11, so a global built by a constructor or a typed literal failed under -pedantic-errors; gcc says so, clang lets it pass.
This commit is contained in:
14
semen.scm
14
semen.scm
@@ -1878,7 +1878,8 @@
|
||||
core
|
||||
(if (> (length core) 3)
|
||||
(append (take core 3)
|
||||
(walk-operands core (drop core 3) env))
|
||||
(map bare-braces
|
||||
(walk-operands core (drop core 3) env)))
|
||||
core))
|
||||
env)))
|
||||
(form (if qualifier
|
||||
@@ -1888,6 +1889,17 @@
|
||||
(add-name-type! (second core) (third core)))
|
||||
(cons form (append (hash-table-ref env :lambda-aux-code) acc))))
|
||||
|
||||
;;; A compound literal is not a constant, though cc lets one pass at file
|
||||
;;; scope unless asked to be pedantic; where it initializes, its braces
|
||||
;;; alone say the same:
|
||||
;;;
|
||||
;;; (var g t (t/a 1)) -> static t g = {.tag = tǂa, .u = {.a = {1}}}
|
||||
(define (bare-braces form)
|
||||
(if (vector? form)
|
||||
(let ((parts (list-split (vector->list form) ':)))
|
||||
(list->vector (map bare-braces (last parts))))
|
||||
form))
|
||||
|
||||
;;; Utils
|
||||
(define (non-empty-list? form)
|
||||
(and (list? form)
|
||||
|
||||
Reference in New Issue
Block a user