diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/countof-stdcountof.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/countof-stdcountof.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/countof-stdcountof.c b/gcc/testsuite/gcc.dg/countof-stdcountof.c new file mode 100644 index 0000000..2fb0c63 --- /dev/null +++ b/gcc/testsuite/gcc.dg/countof-stdcountof.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-std=c2y -pedantic-errors" } */ + +#include <stdcountof.h> + +#define assert(e) ((e) ? (void) 0 : __builtin_abort ()) + +extern int strcmp (const char *, const char *); + +#ifndef countof +#error "countof not defined" +#endif + +int a[3]; +int b[countof a]; + +#define str(x) #x +#define xstr(x) str(x) + +int +main (void) +{ + assert (strcmp (xstr(countof), "_Countof") == 0); +} |