From b88d0121c625497c2f35f1486deeb554c62f5e66 Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Tue, 16 Oct 2018 20:40:40 +0200 Subject: [PATCH] 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. --- module/mescc/compile.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/mescc/compile.scm b/module/mescc/compile.scm index a3393aff..b7bd406a 100644 --- a/module/mescc/compile.scm +++ b/module/mescc/compile.scm @@ -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))))