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 673021b78b
commit c08d2987b4
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 2 additions and 0 deletions

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))))