diff --git a/tests/util/Makefile b/tests/util/Makefile index d5b27f9a462c..ded3a01df7fe 100644 --- a/tests/util/Makefile +++ b/tests/util/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.8 2010/07/13 21:13:30 jmmv Exp $ +# $NetBSD: Makefile,v 1.9 2010/07/18 10:11:00 jmmv Exp $ .include TESTSDIR= ${TESTSBASE}/util -TESTS_SUBDIRS= awk bzip2 config cut df grep id m4 make mtree ps sdiff sh +TESTS_SUBDIRS= awk bzip2 config cut df grep id m4 make mtree ps sdiff sh xlint TESTS_SH= t_basename TESTS_SH+= t_cp diff --git a/tests/util/xlint/Makefile b/tests/util/xlint/Makefile new file mode 100644 index 000000000000..27b3c3f1fef2 --- /dev/null +++ b/tests/util/xlint/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2010/07/18 10:11:01 jmmv Exp $ + +.include + +TESTSDIR= ${TESTSBASE}/util/xlint + +TESTS_SUBDIRS= lint1 + +.include diff --git a/tests/util/xlint/lint1/Makefile b/tests/util/xlint/lint1/Makefile new file mode 100644 index 000000000000..851ac96d0697 --- /dev/null +++ b/tests/util/xlint/lint1/Makefile @@ -0,0 +1,48 @@ +# $NetBSD: Makefile,v 1.1 2010/07/18 10:11:01 jmmv Exp $ + +NOMAN= # defined + +.include + +TESTSDIR= ${TESTSBASE}/util/xlint/lint1 + +TESTS_SH= t_integration + +FILESDIR= ${TESTSDIR} +FILES= d_c99_complex_num.c +FILES+= d_alignof.c +FILES+= d_c99_for_loops.c +FILES+= d_c99_func.c +FILES+= d_c99_recursive_init.c +FILES+= d_c99_struct_init.c +FILES+= d_c99_union_init1.c +FILES+= d_c99_union_init2.c +FILES+= d_c99_union_init3.c +FILES+= d_c9x_array_init.c +FILES+= d_c9x_recursive_init.c +FILES+= d_cast_init.c +FILES+= d_cast_init2.c +FILES+= d_cast_lhs.c +FILES+= d_compound_literals1.c +FILES+= d_compound_literals2.c +FILES+= d_constant_conv1.c +FILES+= d_constant_conv2.c +FILES+= d_cvt_in_ternary.c +FILES+= d_ellipsis_in_switch.c +FILES+= d_gcc_compound_statements1.c +FILES+= d_gcc_compound_statements2.c +FILES+= d_gcc_compound_statements3.c +FILES+= d_gcc_func.c +FILES+= d_gcc_variable_array_init.c +FILES+= d_incorrect_array_size.c +FILES+= d_long_double_int.c +FILES+= d_nested_structs.c +FILES+= d_nolimit_init.c +FILES+= d_packed_structs.c +FILES+= d_shift_to_narrower_type.c +FILES+= d_type_conv1.c +FILES+= d_type_conv2.c +FILES+= d_type_conv3.c +FILES+= d_zero_sized_arrays.c + +.include diff --git a/tests/util/xlint/lint1/d_alignof.c b/tests/util/xlint/lint1/d_alignof.c new file mode 100644 index 000000000000..4a661346305b --- /dev/null +++ b/tests/util/xlint/lint1/d_alignof.c @@ -0,0 +1,6 @@ +/* __alignof__ */ +int +main(void) +{ + return __alignof__(short); +} diff --git a/tests/util/xlint/lint1/d_c99_complex_num.c b/tests/util/xlint/lint1/d_c99_complex_num.c new file mode 100644 index 000000000000..c3c952e7b722 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_complex_num.c @@ -0,0 +1,7 @@ +double cabs(double _Complex); + +double cabs(double _Complex foo) +{ + double d = __real__ foo; + return d + 0.1fi; +} diff --git a/tests/util/xlint/lint1/d_c99_for_loops.c b/tests/util/xlint/lint1/d_c99_for_loops.c new file mode 100644 index 000000000000..188921d52764 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_for_loops.c @@ -0,0 +1,10 @@ +/* c99 for loops */ +extern void foo(int); + +int +main(void) +{ + for (int i = 0; i < 10; i++) + foo(i); + return 0; +} diff --git a/tests/util/xlint/lint1/d_c99_func.c b/tests/util/xlint/lint1/d_c99_func.c new file mode 100644 index 000000000000..b827bfa9f6bc --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_func.c @@ -0,0 +1,7 @@ +/* C99 __func__ */ + +void +foo(const char *p) { + p = __func__; + foo(p); +} diff --git a/tests/util/xlint/lint1/d_c99_recursive_init.c b/tests/util/xlint/lint1/d_c99_recursive_init.c new file mode 100644 index 000000000000..347644ffe107 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_recursive_init.c @@ -0,0 +1,13 @@ +/* C99 recursive struct/union initialization */ +struct top { + int i; + char c; + union onion { + short us; + char uc; + } u; + char *s; +} c[] = { + { .s = "foo", .c = 'b', .u = { .uc = 'c' } }, + { .i = 1, .c = 'a', .u = { .us = 2 } }, +}; diff --git a/tests/util/xlint/lint1/d_c99_struct_init.c b/tests/util/xlint/lint1/d_c99_struct_init.c new file mode 100644 index 000000000000..a94cbd163897 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_struct_init.c @@ -0,0 +1,10 @@ +/* C99 struct initialization */ +struct { + int i; + char *s; +} c[] = { + { .i = 2, }, + { .s = "foo" }, + { .i = 1, .s = "bar" }, + { .s = "foo", .i = -1 }, +}; diff --git a/tests/util/xlint/lint1/d_c99_union_init1.c b/tests/util/xlint/lint1/d_c99_union_init1.c new file mode 100644 index 000000000000..0e1a1a8323d9 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_union_init1.c @@ -0,0 +1,8 @@ +/* C99 union initialization */ +union { + int i; + char *s; +} c[] = { + { i: 1 }, + { s: "foo" } +}; diff --git a/tests/util/xlint/lint1/d_c99_union_init2.c b/tests/util/xlint/lint1/d_c99_union_init2.c new file mode 100644 index 000000000000..51d34d450f21 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_union_init2.c @@ -0,0 +1,8 @@ +/* C99 union initialization */ +union { + int i[10]; + short s; +} c[] = { + { s: 2 }, + { i: { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } }, +}; diff --git a/tests/util/xlint/lint1/d_c99_union_init3.c b/tests/util/xlint/lint1/d_c99_union_init3.c new file mode 100644 index 000000000000..f5e8b59f4621 --- /dev/null +++ b/tests/util/xlint/lint1/d_c99_union_init3.c @@ -0,0 +1,8 @@ +/* C99 union initialization */ +struct { + int i[10]; + char *s; +} c[] = { + { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, + "foo" }, +}; diff --git a/tests/util/xlint/lint1/d_c9x_array_init.c b/tests/util/xlint/lint1/d_c9x_array_init.c new file mode 100644 index 000000000000..66f0e9ec158e --- /dev/null +++ b/tests/util/xlint/lint1/d_c9x_array_init.c @@ -0,0 +1,6 @@ +/* C9X array initializers */ +int foo[256] = { + [2] = 1, + [3] = 2, + [4 ... 5] = 3 +}; diff --git a/tests/util/xlint/lint1/d_c9x_recursive_init.c b/tests/util/xlint/lint1/d_c9x_recursive_init.c new file mode 100644 index 000000000000..df907cd7a3cd --- /dev/null +++ b/tests/util/xlint/lint1/d_c9x_recursive_init.c @@ -0,0 +1,16 @@ +/* C9X struct/union member init, with nested union and trailing member */ +union node { + void *next; + char *data; +}; +struct foo { + int b; + union node n; + int c; +}; + +struct foo f = { + .b = 1, + .n = { .next = 0, }, + .c = 1 +}; diff --git a/tests/util/xlint/lint1/d_cast_init.c b/tests/util/xlint/lint1/d_cast_init.c new file mode 100644 index 000000000000..36986e800ac4 --- /dev/null +++ b/tests/util/xlint/lint1/d_cast_init.c @@ -0,0 +1,27 @@ +/* cast initialization */ +typedef unsigned char u_char; +typedef unsigned int size_t; +struct sockaddr_x25 { + u_char x25_len; + u_char x25_family; + short x25_net; + char x25_addr[16]; + struct x25opts { + char op_flags; + char op_psize; + char op_wsize; + char op_speed; + } x25_opts; + short x25_udlen; + char x25_udata[16]; +}; + +struct sockaddr_x25 x25_dgmask = { + (unsigned char)(unsigned char)(unsigned int)(unsigned long)(&((( struct sockaddr_x25 *)0)->x25_udata[1])) , + 0, + 0, + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {0, 0, 0, 0}, + -1, + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, +}; diff --git a/tests/util/xlint/lint1/d_cast_init2.c b/tests/util/xlint/lint1/d_cast_init2.c new file mode 100644 index 000000000000..9597d3580397 --- /dev/null +++ b/tests/util/xlint/lint1/d_cast_init2.c @@ -0,0 +1,7 @@ +/* cast initialization as the rhs of a - operand */ +struct sockaddr_dl { + char sdl_data[2]; +}; + +int npdl_datasize = sizeof(struct sockaddr_dl) - +((int) ((unsigned long)&((struct sockaddr_dl *) 0)->sdl_data[0])); diff --git a/tests/util/xlint/lint1/d_cast_lhs.c b/tests/util/xlint/lint1/d_cast_lhs.c new file mode 100644 index 000000000000..eb865695535f --- /dev/null +++ b/tests/util/xlint/lint1/d_cast_lhs.c @@ -0,0 +1,7 @@ +/* pointer casts are valid lhs lvalues */ +struct sockaddr { }; +void +foo() { + unsigned long p = 6; + ((struct sockaddr *)p) = 0; +} diff --git a/tests/util/xlint/lint1/d_compound_literals1.c b/tests/util/xlint/lint1/d_compound_literals1.c new file mode 100644 index 000000000000..cd1987ae17de --- /dev/null +++ b/tests/util/xlint/lint1/d_compound_literals1.c @@ -0,0 +1,11 @@ +/* compound literals */ + +struct p { + short a, b, c, d; +}; + +foo() +{ + struct p me = (struct p) {1, 2, 3, 4}; + me.a = me.b; +} diff --git a/tests/util/xlint/lint1/d_compound_literals2.c b/tests/util/xlint/lint1/d_compound_literals2.c new file mode 100644 index 000000000000..e4ffb929873f --- /dev/null +++ b/tests/util/xlint/lint1/d_compound_literals2.c @@ -0,0 +1,18 @@ +/* compound literals */ + +struct p { + short a, b, c, d; +} zz = { + 1, 2, 3, 4 +}; + +struct p *bar(int i) +{ + static struct p q[10]; + return &q[i]; +} + +foo() +{ + *bar(1) = (struct p) { 1, 2, 3, 4 }; +} diff --git a/tests/util/xlint/lint1/d_constant_conv1.c b/tests/util/xlint/lint1/d_constant_conv1.c new file mode 100644 index 000000000000..53795c5fe858 --- /dev/null +++ b/tests/util/xlint/lint1/d_constant_conv1.c @@ -0,0 +1,9 @@ +/* Flag information-losing constant conversion in argument lists */ + +int f(unsigned int); + +void +should_fail() +{ + f(-1); +} diff --git a/tests/util/xlint/lint1/d_constant_conv2.c b/tests/util/xlint/lint1/d_constant_conv2.c new file mode 100644 index 000000000000..87066c96b5a8 --- /dev/null +++ b/tests/util/xlint/lint1/d_constant_conv2.c @@ -0,0 +1,9 @@ +/* Flag information-losing constant conversion in argument lists */ + +int f(unsigned int); + +void +should_fail() +{ + f(2.1); +} diff --git a/tests/util/xlint/lint1/d_cvt_in_ternary.c b/tests/util/xlint/lint1/d_cvt_in_ternary.c new file mode 100644 index 000000000000..4a6149c67224 --- /dev/null +++ b/tests/util/xlint/lint1/d_cvt_in_ternary.c @@ -0,0 +1,13 @@ +/* CVT node handling in ?: operator */ +typedef unsigned long int size_t; +struct filecore_direntry { + unsigned len:32; +}; +int +main(void) +{ + struct filecore_direntry dirent = { 0 }; + size_t uio_resid = 0; + size_t bytelen = (((dirent.len)<(uio_resid))?(dirent.len):(uio_resid)); + return bytelen; +} diff --git a/tests/util/xlint/lint1/d_ellipsis_in_switch.c b/tests/util/xlint/lint1/d_ellipsis_in_switch.c new file mode 100644 index 000000000000..ba4a338d29ae --- /dev/null +++ b/tests/util/xlint/lint1/d_ellipsis_in_switch.c @@ -0,0 +1,11 @@ +int x(void) +{ + int i = 33; + switch (i) { + case 1 ... 40: + break; + default: + break; + } + return 0; +} diff --git a/tests/util/xlint/lint1/d_gcc_compound_statements1.c b/tests/util/xlint/lint1/d_gcc_compound_statements1.c new file mode 100644 index 000000000000..d970be182648 --- /dev/null +++ b/tests/util/xlint/lint1/d_gcc_compound_statements1.c @@ -0,0 +1,7 @@ +/* GCC compound statements */ + +foo(unsigned long z) +{ + z = ({ unsigned long tmp; tmp = 1; tmp; }); + foo(z); +} diff --git a/tests/util/xlint/lint1/d_gcc_compound_statements2.c b/tests/util/xlint/lint1/d_gcc_compound_statements2.c new file mode 100644 index 000000000000..fa1ee67302c5 --- /dev/null +++ b/tests/util/xlint/lint1/d_gcc_compound_statements2.c @@ -0,0 +1,14 @@ +/* GCC compound statements with non-expressions */ +struct cpu_info { + int bar; +}; + +int +main(void) +{ + return ({ + struct cpu_info *__ci; + __asm__ volatile("movl %%fs:4,%0":"=r" (__ci)); + __ci; + })->bar; +} diff --git a/tests/util/xlint/lint1/d_gcc_compound_statements3.c b/tests/util/xlint/lint1/d_gcc_compound_statements3.c new file mode 100644 index 000000000000..29e9063dcf4a --- /dev/null +++ b/tests/util/xlint/lint1/d_gcc_compound_statements3.c @@ -0,0 +1,10 @@ +/* GCC compound statements with void type */ + +void +main(void) +{ + ({ + void *v; + __asm__ volatile("noop"); + }); +} diff --git a/tests/util/xlint/lint1/d_gcc_func.c b/tests/util/xlint/lint1/d_gcc_func.c new file mode 100644 index 000000000000..459919de2955 --- /dev/null +++ b/tests/util/xlint/lint1/d_gcc_func.c @@ -0,0 +1,7 @@ +/* gcc __FUNCTION__ */ + +void +foo(const char *p) { + p = __FUNCTION__; + foo(p); +} diff --git a/tests/util/xlint/lint1/d_gcc_variable_array_init.c b/tests/util/xlint/lint1/d_gcc_variable_array_init.c new file mode 100644 index 000000000000..d5b01ad0c2d2 --- /dev/null +++ b/tests/util/xlint/lint1/d_gcc_variable_array_init.c @@ -0,0 +1,7 @@ +/* gcc: variable array initializer */ +void foo(int i) +{ + int array[i]; + while (i--) + foo(array[i] = 0); +} diff --git a/tests/util/xlint/lint1/d_incorrect_array_size.c b/tests/util/xlint/lint1/d_incorrect_array_size.c new file mode 100644 index 000000000000..c86c0d6b3b70 --- /dev/null +++ b/tests/util/xlint/lint1/d_incorrect_array_size.c @@ -0,0 +1,3 @@ +struct foo { + int a[-1]; +}; diff --git a/tests/util/xlint/lint1/d_long_double_int.c b/tests/util/xlint/lint1/d_long_double_int.c new file mode 100644 index 000000000000..a5a644e3e3d4 --- /dev/null +++ b/tests/util/xlint/lint1/d_long_double_int.c @@ -0,0 +1,7 @@ +/* PR 39639: writing "long double" gave "long int" */ + +int +fail(long double *a, long int *b) +{ + return a == b; +} diff --git a/tests/util/xlint/lint1/d_nested_structs.c b/tests/util/xlint/lint1/d_nested_structs.c new file mode 100644 index 000000000000..edd3396bd224 --- /dev/null +++ b/tests/util/xlint/lint1/d_nested_structs.c @@ -0,0 +1,21 @@ +/* Nested struct */ +typedef void *EditLine; +typedef void *History; + +typedef struct { + EditLine *el; + History *hist; +} el_mode_t; + +struct el_modes_s { + el_mode_t command; + el_mode_t string; + el_mode_t filec; + el_mode_t mime_enc; +}; + +struct el_modes_s elm = { + .command = { .el = 0, .hist = 0, }, + .string = { .el = 0, .hist = 0, }, + .filec = { .el = 0, .hist = 0, }, +}; diff --git a/tests/util/xlint/lint1/d_nolimit_init.c b/tests/util/xlint/lint1/d_nolimit_init.c new file mode 100644 index 000000000000..68e71b4df050 --- /dev/null +++ b/tests/util/xlint/lint1/d_nolimit_init.c @@ -0,0 +1,4 @@ +/* no limit initializers */ +char foo[][4] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; diff --git a/tests/util/xlint/lint1/d_packed_structs.c b/tests/util/xlint/lint1/d_packed_structs.c new file mode 100644 index 000000000000..71b438496f92 --- /dev/null +++ b/tests/util/xlint/lint1/d_packed_structs.c @@ -0,0 +1,35 @@ +/* packed tests */ + +struct in_addr { + int x; +}; +struct ip_timestamp { + char ipt_code; + char ipt_len; + char ipt_ptr; + unsigned int ipt_flg:4, + ipt_oflw:4; + union ipt_timestamp { + int ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + int ipt_time; + } ipt_ta[1] __packed; + } ipt_timestamp __packed; +} __packed; + +typedef struct __packed { + int x; +} t; + +struct x { + char c; + long l; +} __packed; + +struct y { + char c; + long l; +}; + +int a[sizeof(struct y) - sizeof(struct x) - 1]; diff --git a/tests/util/xlint/lint1/d_shift_to_narrower_type.c b/tests/util/xlint/lint1/d_shift_to_narrower_type.c new file mode 100644 index 000000000000..0208944a2d12 --- /dev/null +++ b/tests/util/xlint/lint1/d_shift_to_narrower_type.c @@ -0,0 +1,24 @@ +// Test that type shifts that result to narrower types don't produce warnings. + +void +foo(void) { + unsigned long l = 100; + unsigned long long ll = 100; + unsigned int i = 100; + unsigned short s = 100; + unsigned char c = 1; + + l = ll >> 32; +// i = ll >> 31; + i = ll >> 32; + s = ll >> 48; + c = ll >> 56; + s = i >> 16; + c = i >> 24; + c = s >> 8; + (void)≪ + (void)&l; + (void)&i; + (void)&s; + (void)&c; +} diff --git a/tests/util/xlint/lint1/d_type_conv1.c b/tests/util/xlint/lint1/d_type_conv1.c new file mode 100644 index 000000000000..d9e470e941b9 --- /dev/null +++ b/tests/util/xlint/lint1/d_type_conv1.c @@ -0,0 +1,11 @@ +/* Flag information-losing type conversion in argument lists */ + +int f(unsigned int); + +void +should_fail() +{ + long long x = 20; + + f(x); +} diff --git a/tests/util/xlint/lint1/d_type_conv2.c b/tests/util/xlint/lint1/d_type_conv2.c new file mode 100644 index 000000000000..7c2e1f478ecd --- /dev/null +++ b/tests/util/xlint/lint1/d_type_conv2.c @@ -0,0 +1,11 @@ +/* Flag information-losing type conversion in argument lists */ + +int f(float); + +void +should_fail() +{ + double x = 2.0; + + f(x); +} diff --git a/tests/util/xlint/lint1/d_type_conv3.c b/tests/util/xlint/lint1/d_type_conv3.c new file mode 100644 index 000000000000..bc6a8e695ada --- /dev/null +++ b/tests/util/xlint/lint1/d_type_conv3.c @@ -0,0 +1,10 @@ +/* Flag information-losing type conversion in argument lists */ + +int f(unsigned int); + +void +should_fail() +{ + + f(0x7fffffffffffffffLL); +} diff --git a/tests/util/xlint/lint1/d_zero_sized_arrays.c b/tests/util/xlint/lint1/d_zero_sized_arrays.c new file mode 100644 index 000000000000..9c06c6b5e413 --- /dev/null +++ b/tests/util/xlint/lint1/d_zero_sized_arrays.c @@ -0,0 +1,3 @@ +struct foo { +int a[0]; +}; diff --git a/tests/util/xlint/lint1/t_integration.sh b/tests/util/xlint/lint1/t_integration.sh new file mode 100644 index 000000000000..6864b85510de --- /dev/null +++ b/tests/util/xlint/lint1/t_integration.sh @@ -0,0 +1,126 @@ +# $NetBSD: t_integration.sh,v 1.1 2010/07/18 10:11:01 jmmv Exp $ +# +# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +LINT1=/usr/libexec/lint1 + +Names= + +check_valid() +{ + atf_check -s exit:0 ${LINT1} -g -S "$(atf_get_srcdir)/$1" /dev/null +} + +check_invalid() +{ + atf_check -s not-exit:0 -o ignore -e ignore ${LINT1} -g -S -w \ + "$(atf_get_srcdir)/$1" /dev/null +} + +test_case() +{ + local result="${1}"; shift + local name="${1}"; shift + local descr="${*}" + + atf_test_case ${name} + eval "${name}_head() { + atf_set \"descr\" \"${descr}\"; + }" + eval "${name}_body() { + ${result} d_${name}.c; + }" + + Names="${Names} ${name}" +} + +test_case check_valid c99_struct_init "Checks C99 struct initialization" +test_case check_valid c99_union_init1 "Checks C99 union initialization" +test_case check_valid c99_union_init2 "Checks C99 union initialization" +test_case check_valid c99_union_init3 "Checks C99 union initialization" +test_case check_valid c99_recursive_init "Checks C99 recursive struct/union" \ + "initialization" +test_case check_valid c9x_recursive_init "Checks C9X struct/union member" \ + "init, with nested union and trailing member" +test_case check_valid nested_structs "Checks nested structs" +test_case check_valid packed_structs "Checks packed structs" + +test_case check_valid cast_init "Checks cast initialization" +test_case check_valid cast_init2 "Checks cast initialization as the rhs of a" \ + "- operand" +test_case check_valid cast_lhs "Checks whether pointer casts are valid lhs" \ + "lvalues" + +test_case check_valid gcc_func "Checks GCC __FUNCTION__" +test_case check_valid c99_func "Checks C99 __func__" + +test_case check_valid gcc_variable_array_init "Checks GCC variable array" \ + "initializers" +test_case check_valid c9x_array_init "Checks C9X array initializers" +test_case check_valid nolimit_init "Checks no limit initializers" +test_case check_valid zero_sized_arrays "Checks zero sized arrays" + +test_case check_valid compound_literals1 "Checks compound literals" +test_case check_valid compound_literals2 "Checks compound literals" +test_case check_valid gcc_compound_statements1 "Checks GCC compound statements" +test_case check_valid gcc_compound_statements2 "Checks GCC compound" \ + "statements with non-expressions" +test_case check_valid gcc_compound_statements3 "Checks GCC compound" \ + "statements with void type" + +test_case check_valid cvt_in_ternary "Checks CVT nodes handling in ?" \ + "operator" +test_case check_valid ellipsis_in_switch "Checks ellipsis in switch()" +test_case check_valid c99_complex_num "Checks C99 complex numbers" +test_case check_valid c99_for_loops "Checks C99 for loops" +test_case check_valid alignof "Checks __alignof__" +test_case check_valid shift_to_narrower_type "Checks that type shifts that" \ + "result in narrower types do not produce warnings" + +test_case check_invalid constant_conv1 "Checks failing on information-losing" \ + "constant conversion in argument lists" +test_case check_invalid constant_conv2 "Checks failing on information-losing" \ + "constant conversion in argument lists" + +test_case check_invalid type_conv1 "Checks failing on information-losing" \ + "type conversion in argument lists" +test_case check_invalid type_conv2 "Checks failing on information-losing" \ + "type conversion in argument lists" +test_case check_invalid type_conv3 "Checks failing on information-losing" \ + "type conversion in argument lists" + +test_case check_invalid incorrect_array_size "Checks failing on incorrect" \ + "array sizes" + +test_case check_invalid long_double_int "Checks for confusion of 'long" \ + "double' with 'long int'; PR 39639" + +atf_init_test_cases() +{ + for name in ${Names}; do + atf_add_test_case ${name} + done +}