diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libc/Makefile | 4 | ||||
| -rw-r--r-- | src/regress/lib/libc/ffs/Makefile | 6 | ||||
| -rw-r--r-- | src/regress/lib/libc/ffs/ffs_test.c | 18 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile index 3d0712f951..9ad3120961 100644 --- a/src/regress/lib/libc/Makefile +++ b/src/regress/lib/libc/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.55 2020/03/23 03:01:21 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.56 2020/06/26 20:16:21 naddy Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR+= _setjmp | 3 | SUBDIR+= _setjmp |
| 4 | SUBDIR+= alloca arc4random-fork atexit | 4 | SUBDIR+= alloca arc4random-fork atexit |
| @@ -6,7 +6,7 @@ SUBDIR+= basename | |||
| 6 | SUBDIR+= cephes cxa-atexit | 6 | SUBDIR+= cephes cxa-atexit |
| 7 | SUBDIR+= db dirname | 7 | SUBDIR+= db dirname |
| 8 | SUBDIR+= env explicit_bzero | 8 | SUBDIR+= env explicit_bzero |
| 9 | SUBDIR+= fmemopen fnmatch fpclassify fread | 9 | SUBDIR+= ffs fmemopen fnmatch fpclassify fread |
| 10 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob | 10 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob |
| 11 | SUBDIR+= hsearch | 11 | SUBDIR+= hsearch |
| 12 | SUBDIR+= ieeefp ifnameindex | 12 | SUBDIR+= ieeefp ifnameindex |
diff --git a/src/regress/lib/libc/ffs/Makefile b/src/regress/lib/libc/ffs/Makefile new file mode 100644 index 0000000000..1ad004394f --- /dev/null +++ b/src/regress/lib/libc/ffs/Makefile | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | PROG= ffs_test | ||
| 2 | |||
| 3 | # prevent constant folding and inlining of __builtin_ffs() | ||
| 4 | CFLAGS+= -ffreestanding | ||
| 5 | |||
| 6 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/ffs/ffs_test.c b/src/regress/lib/libc/ffs/ffs_test.c new file mode 100644 index 0000000000..bc1e5c53c2 --- /dev/null +++ b/src/regress/lib/libc/ffs/ffs_test.c | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* $OpenBSD: ffs_test.c,v 1.1 2020/06/26 20:16:22 naddy Exp $ */ | ||
| 2 | /* | ||
| 3 | * Written by Christian Weisgerber <naddy@openbsd.org>. | ||
| 4 | * Public domain. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <assert.h> | ||
| 8 | #include <stdint.h> | ||
| 9 | #include <string.h> | ||
| 10 | |||
| 11 | int | ||
| 12 | main(void) | ||
| 13 | { | ||
| 14 | assert(ffs(0) == 0); | ||
| 15 | assert(ffs(0x8080) == 8); | ||
| 16 | assert(ffs(INT32_MIN) == 32); | ||
| 17 | return (0); | ||
| 18 | } | ||
