Mercurial > hg > octave-nkf > gnulib-hg
changeset 8754:1f57552cdb11
Better ASSERT macro.
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-29 Bruno Haible <bruno@clisp.org> + + * tests/**/test-*.[hc] (ASSERT): Use fprintf to show the line number. + This helps debugging on systems on which no gdb is available. + 2007-04-29 Bruno Haible <bruno@clisp.org> * lib/freading.h: Improve comments.
--- a/tests/test-argmatch.c +++ b/tests/test-argmatch.c @@ -24,11 +24,21 @@ #include "argmatch.h" +#include <stdio.h> #include <stdlib.h> #include "progname.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) enum backup_type {
--- a/tests/test-array_list.c +++ b/tests/test-array_list.c @@ -22,6 +22,7 @@ #include "gl_array_list.h" +#include <stdio.h> #include <stdlib.h> #include "progname.h" @@ -32,7 +33,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-array_oset.c +++ b/tests/test-array_oset.c @@ -22,6 +22,7 @@ #include "gl_array_oset.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -35,7 +36,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-avltree_list.c +++ b/tests/test-avltree_list.c @@ -22,6 +22,7 @@ #include "gl_avltree_list.h" +#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" @@ -35,7 +36,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-avltree_oset.c +++ b/tests/test-avltree_oset.c @@ -22,6 +22,7 @@ #include "gl_avltree_oset.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -37,7 +38,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-avltreehash_list.c +++ b/tests/test-avltreehash_list.c @@ -23,6 +23,7 @@ #include "gl_avltreehash_list.h" #include <limits.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -62,7 +63,16 @@ } #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-binary-io.c +++ b/tests/test-binary-io.c @@ -30,7 +30,16 @@ #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-byteswap.c +++ b/tests/test-byteswap.c @@ -21,9 +21,19 @@ #include <byteswap.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-c-ctype.c +++ b/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,9 +24,19 @@ #include "c-ctype.h" #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static void test_all (void)
--- a/tests/test-c-strcasecmp.c +++ b/tests/test-c-strcasecmp.c @@ -24,10 +24,20 @@ #include "c-strcase.h" #include <locale.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main (int argc, char *argv[])
--- a/tests/test-c-strcasestr.c +++ b/tests/test-c-strcasestr.c @@ -23,10 +23,20 @@ #include "c-strcasestr.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-c-strncasecmp.c +++ b/tests/test-c-strncasecmp.c @@ -24,10 +24,20 @@ #include "c-strcase.h" #include <locale.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main (int argc, char *argv[])
--- a/tests/test-c-strstr.c +++ b/tests/test-c-strstr.c @@ -23,10 +23,20 @@ #include "c-strstr.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-canonicalize-lgpl.c +++ b/tests/test-canonicalize-lgpl.c @@ -23,10 +23,20 @@ #include "canonicalize.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-carray_list.c +++ b/tests/test-carray_list.c @@ -22,6 +22,7 @@ #include "gl_carray_list.h" +#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" @@ -33,7 +34,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-fbufmode.c +++ b/tests/test-fbufmode.c @@ -21,9 +21,19 @@ #include "fbufmode.h" +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-fbufmode.tmp"
--- a/tests/test-fprintf-posix.c +++ b/tests/test-fprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #include "test-fprintf-posix.h"
--- a/tests/test-fpurge.c +++ b/tests/test-fpurge.c @@ -21,10 +21,20 @@ #include "fpurge.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-fpurge.tmp"
--- a/tests/test-freadable.c +++ b/tests/test-freadable.c @@ -21,9 +21,19 @@ #include "freadable.h" +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-freadable.tmp"
--- a/tests/test-freading.c +++ b/tests/test-freading.c @@ -21,9 +21,19 @@ #include "freading.h" +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-freading.tmp"
--- a/tests/test-frexp.c +++ b/tests/test-frexp.c @@ -22,11 +22,21 @@ #include <math.h> #include <float.h> +#include <stdio.h> #include <stdlib.h> #include "isnan.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ #ifdef __DECC
--- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -22,12 +22,22 @@ #include <math.h> #include <float.h> +#include <stdio.h> #include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. For exponents below that, the
--- a/tests/test-fwritable.c +++ b/tests/test-fwritable.c @@ -21,9 +21,19 @@ #include "fwritable.h" +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-fwritable.tmp"
--- a/tests/test-fwriting.c +++ b/tests/test-fwriting.c @@ -21,9 +21,19 @@ #include "fwriting.h" +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define TESTFILE "t-fwriting.tmp"
--- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -26,10 +26,20 @@ #endif #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -22,9 +22,19 @@ #include "isnan.h" #include <limits.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ #ifdef __DECC
--- a/tests/test-isnanf.c +++ b/tests/test-isnanf.c @@ -22,9 +22,19 @@ #include "isnanf.h" #include <limits.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ #ifdef __DECC
--- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -18,9 +18,19 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-ldexpl.c +++ b/tests/test-ldexpl.c @@ -22,12 +22,22 @@ #include <math.h> #include <float.h> +#include <stdio.h> #include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-linked_list.c +++ b/tests/test-linked_list.c @@ -22,6 +22,7 @@ #include "gl_linked_list.h" +#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" @@ -33,7 +34,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-linkedhash_list.c +++ b/tests/test-linkedhash_list.c @@ -23,6 +23,7 @@ #include "gl_linkedhash_list.h" #include <limits.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -60,7 +61,16 @@ } #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-mbscasecmp.c +++ b/tests/test-mbscasecmp.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbscasestr1.c +++ b/tests/test-mbscasestr1.c @@ -23,9 +23,19 @@ #include <string.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbscasestr2.c +++ b/tests/test-mbscasestr2.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbscasestr3.c +++ b/tests/test-mbscasestr3.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbscasestr4.c +++ b/tests/test-mbscasestr4.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbschr.c +++ b/tests/test-mbschr.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbscspn.c +++ b/tests/test-mbscspn.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsncasecmp.c +++ b/tests/test-mbsncasecmp.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbspbrk.c +++ b/tests/test-mbspbrk.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbspcasecmp.c +++ b/tests/test-mbspcasecmp.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsrchr.c +++ b/tests/test-mbsrchr.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsspn.c +++ b/tests/test-mbsspn.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsstr1.c +++ b/tests/test-mbsstr1.c @@ -23,9 +23,19 @@ #include <string.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsstr2.c +++ b/tests/test-mbsstr2.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-mbsstr3.c +++ b/tests/test-mbsstr3.c @@ -24,9 +24,19 @@ #include <string.h> #include <locale.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-printf-frexp.c +++ b/tests/test-printf-frexp.c @@ -22,9 +22,19 @@ #include "printf-frexp.h" #include <float.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static double my_ldexp (double x, int d)
--- a/tests/test-printf-frexpl.c +++ b/tests/test-printf-frexpl.c @@ -22,11 +22,21 @@ #include "printf-frexpl.h" #include <float.h> +#include <stdio.h> #include <stdlib.h> #include "fpucw.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. For exponents below that, the
--- a/tests/test-printf-posix.c +++ b/tests/test-printf-posix.c @@ -24,11 +24,21 @@ #include <stdio.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #include "test-printf-posix.h"
--- a/tests/test-rbtree_list.c +++ b/tests/test-rbtree_list.c @@ -22,6 +22,7 @@ #include "gl_rbtree_list.h" +#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" @@ -35,7 +36,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-rbtree_oset.c +++ b/tests/test-rbtree_oset.c @@ -22,6 +22,7 @@ #include "gl_rbtree_oset.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -37,7 +38,16 @@ }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-rbtreehash_list.c +++ b/tests/test-rbtreehash_list.c @@ -23,6 +23,7 @@ #include "gl_rbtreehash_list.h" #include <limits.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -62,7 +63,16 @@ } #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
--- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -22,9 +22,19 @@ #include <math.h> #include <limits.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) float zerof = 0.0f; double zerod = 0.0;
--- a/tests/test-snprintf-posix.c +++ b/tests/test-snprintf-posix.c @@ -24,11 +24,21 @@ #include <stdio.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #include "test-snprintf-posix.h"
--- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -26,7 +26,16 @@ #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main (int argc, char *argv[])
--- a/tests/test-sprintf-posix.c +++ b/tests/test-sprintf-posix.c @@ -24,11 +24,21 @@ #include <stdio.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #include "test-sprintf-posix.h"
--- a/tests/test-stat-time.c +++ b/tests/test-stat-time.c @@ -28,7 +28,16 @@ #include <sys/stat.h> #include <unistd.h> -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) enum { NFILES = 4 };
--- a/tests/test-strcasestr.c +++ b/tests/test-strcasestr.c @@ -23,9 +23,19 @@ #include <string.h> +#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-striconv.c +++ b/tests/test-striconv.c @@ -28,10 +28,20 @@ #endif #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -28,11 +28,21 @@ #endif #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1
--- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -28,11 +28,21 @@ #endif #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1
--- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ #ifdef __DECC
--- a/tests/test-vasnprintf-posix2.c +++ b/tests/test-vasnprintf-posix2.c @@ -24,10 +24,20 @@ #include "vasnprintf.h" #include <locale.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main (int argc, char *argv[])
--- a/tests/test-vasnprintf.c +++ b/tests/test-vasnprintf.c @@ -24,10 +24,20 @@ #include "vasnprintf.h" #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static char * my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
--- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ #ifdef __DECC
--- a/tests/test-vasprintf.c +++ b/tests/test-vasprintf.c @@ -27,7 +27,16 @@ #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_asprintf (char **result, const char *format, ...)
--- a/tests/test-vfprintf-posix.c +++ b/tests/test-vfprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_fprintf (FILE *fp, const char *format, ...)
--- a/tests/test-vprintf-posix.c +++ b/tests/test-vprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_printf (const char *format, ...)
--- a/tests/test-vsnprintf-posix.c +++ b/tests/test-vsnprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_snprintf (char *str, size_t size, const char *format, ...)
--- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -27,7 +27,16 @@ #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_snprintf (char *buf, int size, const char *format, ...)
--- a/tests/test-vsprintf-posix.c +++ b/tests/test-vsprintf-posix.c @@ -25,11 +25,21 @@ #include <stdarg.h> #include <stddef.h> +#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static int my_sprintf (char *str, const char *format, ...)
--- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -24,12 +24,22 @@ #include "xvasprintf.h" #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "progname.h" -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) static char * my_xasprintf (const char *format, ...)
--- a/tests/uniconv/test-u16-conv-from-enc.c +++ b/tests/uniconv/test-u16-conv-from-enc.c @@ -23,13 +23,23 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1
--- a/tests/uniconv/test-u16-strconv-from-enc.c +++ b/tests/uniconv/test-u16-strconv-from-enc.c @@ -23,12 +23,22 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/uniconv/test-u16-strconv-to-enc.c +++ b/tests/uniconv/test-u16-strconv-to-enc.c @@ -24,11 +24,21 @@ #include "uniconv.h" #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/uniconv/test-u32-conv-from-enc.c +++ b/tests/uniconv/test-u32-conv-from-enc.c @@ -23,13 +23,23 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1
--- a/tests/uniconv/test-u32-strconv-from-enc.c +++ b/tests/uniconv/test-u32-strconv-from-enc.c @@ -23,12 +23,22 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/uniconv/test-u32-strconv-to-enc.c +++ b/tests/uniconv/test-u32-strconv-to-enc.c @@ -24,11 +24,21 @@ #include "uniconv.h" #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/uniconv/test-u8-conv-from-enc.c +++ b/tests/uniconv/test-u8-conv-from-enc.c @@ -23,13 +23,23 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1
--- a/tests/uniconv/test-u8-strconv-from-enc.c +++ b/tests/uniconv/test-u8-strconv-from-enc.c @@ -23,12 +23,22 @@ #include "uniconv.h" +#include <stdio.h> #include <stdlib.h> #include "unistr.h" #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()
--- a/tests/uniconv/test-u8-strconv-to-enc.c +++ b/tests/uniconv/test-u8-strconv-to-enc.c @@ -24,11 +24,21 @@ #include "uniconv.h" #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) if (!(expr)) abort (); +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main ()