X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/57510b6e4963ad39846a4f4c7fbd4ce7145f426d..HEAD:/tests/decl-bad.at diff --git a/tests/decl-bad.at b/tests/decl-bad.at index 3692206..62af91c 100644 --- a/tests/decl-bad.at +++ b/tests/decl-bad.at @@ -1,4 +1,4 @@ -# Copyright © 2020 Nick Bowler +# Copyright © 2020, 2023 Nick Bowler # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ AT_BANNER([Invalid C declarations]) m4_define([CHECK_BADDECL], - [AT_CHECK([if cdecl99 -e '$1'; then exit 1; fi], [0], [], [stderr])]) + [AT_CHECK([cdecl99 -e '$1'], [1], [], [stderr])]) m4_define([SIMPLE_BADDECL], [AT_SETUP([$1]) @@ -27,6 +27,8 @@ SIMPLE_BADDECL([Reject invalid identifiers], [explain int x$], [declare x$ as int]) SIMPLE_BADDECL([Reject long long long], [explain long long long x], [declare x as long long long]) +SIMPLE_BADDECL([Reject long long double], + [explain long long double x], [declare x as long long double]) SIMPLE_BADDECL([Reject inline on object declarations], [explain inline int x], [declare x as inline int]) @@ -42,7 +44,21 @@ SIMPLE_BADDECL([Reject implicit int], SIMPLE_BADDECL([Reject void declarations], [explain void x], [declare x as void]) SIMPLE_BADDECL([Reject complex integers], - [explain int _Complex x], [declare x as int _Complex]) + [explain int _Complex x], [declare x as int _Complex], + [explain short _Complex x], [declare x as short _Complex], + [explain long _Complex x], [declare x as long _Complex], + [explain char _Complex x], [declare x as char _Complex]) +SIMPLE_BADDECL([Reject imaginary integers], + [explain int _Imaginary x], [declare x as int _Imaginary], + [explain short _Imaginary x], [declare x as short _Imaginary], + [explain long _Imaginary x], [declare x as long _Imaginary], + [explain char _Imaginary x], [declare x as char _Imaginary]) +SIMPLE_BADDECL([Reject signed floats], + [explain signed float x], [declare x as signed float], + [explain signed double x], [declare x as signed double]) +SIMPLE_BADDECL([Reject unsigned floats], + [explain unsigned float x], [declare x as unsigned float], + [explain unsigned double x], [declare x as unsigned double]) dnl C99§6.7.3p2: Types other than pointer types derived from object or dnl incomplete types shall not be restrict-qualified. @@ -58,10 +74,8 @@ SIMPLE_BADDECL([Reject ... with no formal parameters], [declare f as function (...) returning void]) SIMPLE_BADDECL([Reject identifier lists with extra parentheses], - [explain int f((x))]) - -SIMPLE_BADDECL([Reject parameter types with extra parentheses], - [explain int ((int))]) + [explain int f((x))], + [explain int f(())]) dnl TODO: Find C&V which actually prohibits these "obviously wrong" dnl declarations. @@ -133,3 +147,10 @@ SIMPLE_BADDECL([Reject multiple declarators in type names], [explain int f, g((x))], [explain int x, (void)], [explain int [[5]], (void)]) + +SIMPLE_BADDECL([Error recovery on multiple object declaration], + [explain int inline x, y]) + +SIMPLE_BADDECL([Reject hyphens in identifiers], + [explain int ac-dc], + [explain int variable-length])