diff options
author | ngie <ngie@FreeBSD.org> | 2017-02-10 01:13:12 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-02-10 01:13:12 +0000 |
commit | 8864cde3495dbfd6b476c1b77a8bde035e1cf000 (patch) | |
tree | da558c97672e3d32f9e5551cd2daccd8684c5f03 /contrib/netbsd-tests/usr.bin/xlint/lint1 | |
parent | 9c6235cf2af8bdadcd0f0a80288683f0c88f3e55 (diff) | |
download | FreeBSD-src-8864cde3495dbfd6b476c1b77a8bde035e1cf000.zip FreeBSD-src-8864cde3495dbfd6b476c1b77a8bde035e1cf000.tar.gz |
MFC r305358,r305449,r305451,r306367,r306397,r309474:
This also contains a merge of ^/projects/netbsd-tests-update-12@r304035 .
This change never hit ^/head because bin/cat's behavior was changed (on ^/head)
to match NetBSD.
PR: 210607
r305358:
Update contrib/netbsd-tests with new content from NetBSD
This updates the snapshot from 09/30/2014 to 08/11/2016
This brings in a number of new testcases from upstream, most
notably:
- bin/cat
- lib/libc
- lib/msun
- lib/libthr
- usr.bin/sort
lib/libc/tests/stdio/open_memstream_test.c was moved to
lib/libc/tests/stdio/open_memstream2_test.c to accomodate
the new open_memstream test from NetBSD.
Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox
r305449:
Install h_db to unbreak some of the lib/libc/db testcases after
r305358
r305451:
Fix lib/libc/rpc test assumptions added in r305358
- Require root in the tcp/udp subtests (it's needed on FreeBSD when
registering services).
- Skip the tests if service registration fails.
r306367 (by br):
Allow up to 6 arguments only on MIPS.
r306397 (by br):
Use right piece of code for FreeBSD.
r309474:
Don't build :strvis_locale if VIS_NOLOCALE is undefined
The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features
in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower
in conditionally running the test instead of backporting the newer version of
libc-vis
Diffstat (limited to 'contrib/netbsd-tests/usr.bin/xlint/lint1')
8 files changed, 131 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c new file mode 100644 index 0000000..367b56f --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c @@ -0,0 +1,26 @@ +/* Anonymous struct test */ + +typedef int type; + +struct point { + int x; + int y; +}; + +struct bar { + struct { + struct point top_left; + struct point bottom_right; + }; + type z; +}; + + +int +main(void) +{ + struct bar b; + b.top_left.x = 1; + return 0; +} + diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c new file mode 100644 index 0000000..ca70694 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c @@ -0,0 +1,14 @@ +struct bintime { + unsigned long long sec; + unsigned long long frac; +}; + +struct bintime +us2bintime(unsigned long long us) +{ + + return (struct bintime) { + .sec = us / 1000000U, + .frac = (((us % 1000000U) >> 32)/1000000U) >> 32, + }; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c new file mode 100644 index 0000000..e7b8756 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c @@ -0,0 +1,6 @@ +/* Allow packed c99 flexible arrays */ +struct { + int x; + char y[0]; +} __packed foo; + diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c new file mode 100644 index 0000000..15410c8 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c @@ -0,0 +1,25 @@ +/* C99 nested struct init with named and non-named initializers */ +typedef struct pthread_mutex_t { + unsigned int ptm_magic; + char ptm_errorcheck; + + char ptm_pad1[3]; + + char ptm_interlock; + + char ptm_pad2[3]; + + volatile void * ptm_owner; + void * volatile ptm_waiters; + unsigned int ptm_recursed; + void *ptm_spare2; +} pthread_mutex_t; + + +struct arc4random_global { + + pthread_mutex_t lock; +} arc4random_global = { + + .lock = { 0x33330003, 0, { 0, 0, 0 }, 0, { 0, 0, 0 }, ((void *)0), ((void *)0), 0, ((void *)0) }, +}; diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c new file mode 100644 index 0000000..f73b113 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c @@ -0,0 +1,15 @@ +/* test .data.l[x] */ +typedef struct { + int type; + union { + char b[20]; + short s[10]; + long l[5]; + } data; +} foo; + + +foo bar = { + .type = 3, + .data.l[0] = 4 +}; diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c new file mode 100644 index 0000000..345c783 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c @@ -0,0 +1,9 @@ + +static void f(void *b[4]) { + (void)&b; +} + +void * +foo(void *fn) { + return fn == 0 ? f : (void (*)(void *[4])) fn; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c new file mode 100644 index 0000000..00f69cd --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c @@ -0,0 +1,14 @@ +/* the type of the ?: expression should be the more specific type */ + +struct foo { + int bar; +}; + +void +test(void) { + int i; + struct foo *ptr = 0; + + for (i = (ptr ? ptr : (void *)0)->bar; i < 10; i++) + test(); +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c new file mode 100644 index 0000000..ad69c51 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c @@ -0,0 +1,22 @@ +/* typedef of function parameter */ + +typedef void (*free_func) (void * opaque, void* address); +typedef struct stack_st +{ + int num; + char **data; + int sorted; + + int num_alloc; + int (*comp)(const void *, const void *); +} _STACK; /* Use STACK_OF(...) instead */ + +typedef void *OPENSSL_BLOCK; +struct stack_st_OPENSSL_BLOCK { _STACK stack; }; +typedef void *d2i_of_void(void **,const unsigned char **,long); typedef int i2d_of_void(void *,unsigned char **); + +struct stack_st_OPENSSL_BLOCK *d2i_ASN1_SET(struct stack_st_OPENSSL_BLOCK **a, + const unsigned char **pp, + long length, d2i_of_void *d2i, + void (*free_func)(OPENSSL_BLOCK), int ex_tag, + int ex_class); |