delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/02/10:17:42

Message-Id: <199709021414.KAA11154@delorie.com>
From: Oberhumer Markus <k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at>
Subject: 970831: <assert.h> patches
To: dj AT delorie DOT com (DJ Delorie), djgpp-workers AT delorie DOT com (djgpp-workers)
Date: Tue, 2 Sep 1997 16:09:17 +0200 (METDST)
Return-Read-To: markus DOT oberhumer AT jk DOT uni-linz DOT ac DOT at
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019