]> git.draconx.ca Git - cdecl99.git/commit
libcdecl: Remove "too many parentheses" error check.
authorNick Bowler <nbowler@draconx.ca>
Thu, 6 Jul 2023 05:59:43 +0000 (01:59 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 7 Jul 2023 00:26:24 +0000 (20:26 -0400)
commitc733aff6d0b2b107c88e37a1491f270db0634819
treecd68fb8b6fab6213df790fe0fe1d535e7cfaddb2
parentf3d0075fed997b037645e866622224d8175dddfd
libcdecl: Remove "too many parentheses" error check.

It is simply not the case that "int ((int))" is invalid.

Since "int (x(int))" declares x as a function returning int, it follows
that "int ((int))" is simply a type name for function returning int.
Likewise, "int (((int)))" is equivalent, etc.

Rejecting these type names is longstanding broken behaviour.  I think
the entire error check can simply be deleted outright, along with its
associated error message.  The bogus negative test cases are replaced
with new positive tests.

Furthermore, rewrite the big comment that suggests this was reasonable
behaviour, replacing it with a (hopefully) better explanation that
covers how this particular case should be interpreted.
src/errmsg.str
src/parse-decl.c
tests/decl-bad.at
tests/decl-good.at