Mail Archives: djgpp-workers/1997/09/02/10:17:42
Subject: 970831: <assert.h> patches
The current implementation of <assert.h> causes warnings when
using compile-time expressions that evaluate to true (like `assert(1);')
in combination with the gcc flags `-Wall -pedantic'.
Markus
*** assert.org Mon Aug 12 18:56:18 1996
--- assert.h Tue Sep 2 14:36:18 1997
***************
*** 1,3 ****
! /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
--- 1,3 ----
! /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
***************
*** 5,11 ****
#if defined(NDEBUG)
! #define assert(test) ((void)0)
#else
! #define assert(test) ((test)?(void)0:(void)__dj_assert(#test,__FILE__,__LINE__))
#endif
--- 5,11 ----
#if defined(NDEBUG)
! #define assert(expr) ((void)0)
#else
! #define assert(expr) ((void)((expr)||(__dj_assert(#expr,__FILE__,__LINE__),0)))
#endif
***************
*** 17,21 ****
#endif
! void __dj_assert(const char *,const char *,int);
#ifdef __cplusplus
--- 17,21 ----
#endif
! void __dj_assert(const char *,const char *,int) __attribute__((__noreturn__));
#ifdef __cplusplus
- Raw text -