assert.h: remove custom macro definitions for lint mode

In lint mode, 'assert(cond)' expanded to nothing.  This broke code like
sqlite that assumes 'assert(cond)' expands to an expression that can be
used as operand of the comma operator, as in 'return assert(i > 0), i'.
This commit is contained in:
rillig 2023-09-12 22:08:24 +00:00
parent 401e0ef38d
commit ac66081df5
1 changed files with 4 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: assert.h,v 1.25 2020/04/17 15:22:34 kamil Exp $ */ /* $NetBSD: assert.h,v 1.26 2023/09/12 22:08:24 rillig Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -48,11 +48,7 @@
#undef assert #undef assert
#ifdef NDEBUG #ifdef NDEBUG
# ifndef __lint__ # define assert(e) (__static_cast(void,0))
# define assert(e) (__static_cast(void,0))
# else /* !__lint__ */
# define assert(e)
# endif /* __lint__ */
#else /* !NDEBUG */ #else /* !NDEBUG */
# if __STDC__ # if __STDC__
# define assert(e) \ # define assert(e) \
@ -67,11 +63,7 @@
#undef _DIAGASSERT #undef _DIAGASSERT
#if !defined(_DIAGNOSTIC) #if !defined(_DIAGNOSTIC)
# if !defined(__lint__) # define _DIAGASSERT(e) (__static_cast(void,0))
# define _DIAGASSERT(e) (__static_cast(void,0))
# else /* !__lint__ */
# define _DIAGASSERT(e)
# endif /* __lint__ */
#else /* _DIAGNOSTIC */ #else /* _DIAGNOSTIC */
# if __STDC__ # if __STDC__
# define _DIAGASSERT(e) \ # define _DIAGASSERT(e) \
@ -85,9 +77,7 @@
#endif /* _DIAGNOSTIC */ #endif /* _DIAGNOSTIC */
#if defined(__lint__) #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __assert_function__ (__static_cast(const void *,0))
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __assert_function__ __func__ #define __assert_function__ __func__
#elif __GNUC_PREREQ__(2, 6) #elif __GNUC_PREREQ__(2, 6)
#define __assert_function__ __PRETTY_FUNCTION__ #define __assert_function__ __PRETTY_FUNCTION__