diff mbox

[4/5] testsuite: simplify the ioc-typecheck case

Message ID 20161102214509.36571-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck Nov. 2, 2016, 9:45 p.m. UTC
The test was relatively convoluted and it wasn't very clear what
was the problem and waht was tested.

The real problem is simply a problem about a non-constant
expression in an array designator.

Simplify the test to clearly show that.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
CC: Hans Verkuil <hans.verkuil@cisco.com>
---
 validation/ioc-typecheck.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Christopher Li Nov. 17, 2016, 4:17 p.m. UTC | #1
On Thu, Nov 3, 2016 at 5:45 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> The test was relatively convoluted and it wasn't very clear what
> was the problem and waht was tested.
>
> The real problem is simply a problem about a non-constant
> expression in an array designator.
>
> Simplify the test to clearly show that.

Applied.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/validation/ioc-typecheck.c b/validation/ioc-typecheck.c
index aa060f7b..34b37d31 100644
--- a/validation/ioc-typecheck.c
+++ b/validation/ioc-typecheck.c
@@ -1,16 +1,10 @@ 
 extern unsigned int __invalid_size_argument_for_IOC;
-#define _IOC_TYPECHECK(t) \
-                ((sizeof(t) == sizeof(t[1]) && \
-                    sizeof(t) < (1 << 14)) ? \
-                   sizeof(t) : __invalid_size_argument_for_IOC)
-
-#define TEST_IOCTL (50 | (_IOC_TYPECHECK(unsigned) << 8))
-
 static unsigned iocnrs[] = {
-        [TEST_IOCTL & 0xff] = 1,
+	[ 1 ?  0 : __invalid_size_argument_for_IOC ] = 1,
 };
 /*
- * check-name: correct handling of _IOC_TYPECHECK
+ * check-name: integer constant & conditional expression
+ * check-known-to-fail
  *
  * check-error-start
  * check-error-end