keep what follows the star of a pointer to a tagged type
fmt-c wrote (const * struct what) as struct what*, and (* * struct what) as struct what*, a pointer short; a pointer to an enum crashed it, the star taken for the enum's values.
This commit is contained in:
@@ -664,7 +664,13 @@
|
||||
"")
|
||||
(if (not (null? body))
|
||||
(cat body)
|
||||
""))))))
|
||||
"")
|
||||
(c-type-words o))))))
|
||||
|
||||
;; MODIFIED FROM UPSTREAM fmt-c: what follows the first star of a
|
||||
;; tagged type, `* const' in (struct what * const), was dropped
|
||||
(define (c-type-words words)
|
||||
(fmt-join (lambda (word) (cat " " word)) words ""))
|
||||
|
||||
(define (c-struct . args) (apply c-struct/aux "struct" args))
|
||||
(define (c-union . args) (apply c-struct/aux "union" args))
|
||||
@@ -679,13 +685,15 @@
|
||||
(if (pair? x) (cat (car x) " = " (c-expr (cadr x))) (dsp x)))
|
||||
(let* ((name (if (null? o) (if (or (symbol? x) (string? x)) x #f) x))
|
||||
(vals (if name (if (null? o) #f (car o)) x)))
|
||||
(if vals
|
||||
;; MODIFIED FROM UPSTREAM fmt-c: (enum mood * const) is a
|
||||
;; pointer, and its star was taken for the list of values
|
||||
(if (pair? vals)
|
||||
(c-wrap-stmt
|
||||
(cat
|
||||
(c-braced-block
|
||||
(if name (cat "enum " name) (dsp "enum"))
|
||||
(c-in-expr (apply c-begin (map c-enum-one vals))))))
|
||||
(c-wrap-stmt (cat "enum " name)))))
|
||||
(c-wrap-stmt (cat "enum " name (or vals "") (c-type-words (if vals (cdr o) '())))))))
|
||||
|
||||
(define (c-attribute . args)
|
||||
(cat "__attribute__ ((" (fmt-join c-expr args ", ") "))"))
|
||||
|
||||
Reference in New Issue
Block a user