mescc: Skip attributes on function definitions.
* module/mescc/preprocess.scm (ast-strip-attributes): New procedure. (c99-input->ast): Use it.
This commit is contained in:
parent
5eaf1c14ef
commit
1e102e1d46
|
@ -112,7 +112,10 @@
|
||||||
(define* (c99-input->ast #:key (prefix "") (defines '()) (includes '()) (arch "") verbose?)
|
(define* (c99-input->ast #:key (prefix "") (defines '()) (includes '()) (arch "") verbose?)
|
||||||
(when verbose?
|
(when verbose?
|
||||||
(stderr "parsing: input\n"))
|
(stderr "parsing: input\n"))
|
||||||
((compose ast-strip-const ast-strip-comment) (c99-input->full-ast #:prefix prefix #:defines defines #:includes includes #:arch arch #:verbose? verbose?)))
|
((compose ast-strip-attributes
|
||||||
|
ast-strip-const
|
||||||
|
ast-strip-comment)
|
||||||
|
(c99-input->full-ast #:prefix prefix #:defines defines #:includes includes #:arch arch #:verbose? verbose?)))
|
||||||
|
|
||||||
(define (ast-strip-comment o)
|
(define (ast-strip-comment o)
|
||||||
(pmatch o
|
(pmatch o
|
||||||
|
@ -142,3 +145,11 @@
|
||||||
((,h . ,t) (if (list? o) (filter-map ast-strip-const o)
|
((,h . ,t) (if (list? o) (filter-map ast-strip-const o)
|
||||||
(cons (ast-strip-const h) (ast-strip-const t))))
|
(cons (ast-strip-const h) (ast-strip-const t))))
|
||||||
(_ o)))
|
(_ o)))
|
||||||
|
|
||||||
|
(define (ast-strip-attributes o)
|
||||||
|
(pmatch o
|
||||||
|
((decl-spec-list (@ (attributes . ,attributes)) . ,rest)
|
||||||
|
`(decl-spec-list ,@rest))
|
||||||
|
((,h . ,t) (if (list? o) (filter-map ast-strip-attributes o)
|
||||||
|
(cons (ast-strip-attributes h) (ast-strip-attributes t))))
|
||||||
|
(_ o)))
|
||||||
|
|
Loading…
Reference in a new issue