mescc: Allow superfluous parentheses in function declarations.

E.g.:  int (f)();
This is obscure but valid C.  It occurs in the csmith headers (thanks
to macro shenanigans).

* module/mescc/compile.scm (fctn-defn:get-name,
fctn-defn:get-statement): Allow superfluous parentheses in function declarations.
This commit is contained in:
Peter De Wachter 2018-10-16 20:40:40 +02:00 committed by Jan Nieuwenhuizen
parent ab57acfa01
commit b560899d84
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -2542,6 +2542,7 @@
(define (fctn-defn:get-name o)
(pmatch o
((_ (ftn-declr (ident ,name) _) _) name)
((_ (ftn-declr (scope (ident ,name)) _) _) name)
((_ (ptr-declr (pointer . _) (ftn-declr (ident ,name) _)) _) name)
(_ (error "fctn-defn:get-name not supported:" o))))
@ -2615,6 +2616,7 @@
(define (fctn-defn:get-statement o)
(pmatch o
((_ (ftn-declr (ident _) _) ,statement) statement)
((_ (ftn-declr (scope (ident _)) _) ,statement) statement)
((_ (ptr-declr (pointer . _) (ftn-declr (ident _) . _)) ,statement) statement)
(_ (error "fctn-defn:get-statement: not supported: " o))))