Article View: gnu.gcc.bug
Article #1719Gnu C 1.28's assert.h and DPANS don't mix
From: Arthur David Olson
Date: Tue, 20 Sep 1988 19:42
Date: Tue, 20 Sep 1988 19:42
70 lines
2313 bytes
2313 bytes
(We're running SunOS 4.0 on a Sun 3/110.)
Description:
The "assert" macro defined in "assert.h" fails to evaluate to a
void expression (see page 74 of the May, 1988 Rationale).
Repeat-By:
Script started on Tue Sep 20 15:37:46 1988
elsie$ cat try.c
#include <stdio.h>
#include <assert.h>
int
main()
{
assert(1), assert(1);
return 0;
}
elsie$ gcc -v try.c
gcc version 1.28
/usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dvax -Dunix try.c /tmp/cc019174.cpp
GNU CPP version 1.28
/usr/local/lib/gcc-cc1 /tmp/cc019174.cpp -quiet -dumpbase try.c -version -o /tmp/cc019174.s
GNU C version 1.28 (vax) compiled by GNU C version 1.28.
try.c:7: parse error before `,'
At top level:
try.c:7: parse error before `}'
elsie$ exit
script done on Tue Sep 20 15:37:59 1988
Fix:
*** 1.1/assert.h Tue Sep 20 15:41:20 1988
--- 1.2/assert.h Tue Sep 20 15:41:22 1988
***************
*** 4,17 ****
#define assert(ignore)
#else
! #define assert(expression) \
! do { if (!(expression)) __assert ((expression), __FILE__, __LINE__); } while (0)
#define __assert(expression, file, line) \
! { _eprintf ("Failed assertion " #expression \
! " at line %d of `" file "'.\n", line); \
! abort (); }
void _eprintf (); /* Defined in gnulib */
#endif
--- 4,18 ----
#define assert(ignore)
#else
! #define assert(expr) \
! ( (expr)? (void)0 : __assert((expr), __FILE__, __LINE__) )
#define __assert(expression, file, line) \
! ( _eprintf ("Failed assertion " #expression \
! " at line %d of `" file "'.\n", line), \
! abort () )
void _eprintf (); /* Defined in gnulib */
+ void abort ();
#endif
--
The Canadian space program is into artificial catatonia.
ado@ncifcrf.gov ADO is a trademark of Ampex.
Technical Details
Message-ID:
<8809201942.AA19209@elsie.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!pollux!ti-csl!cs.utexas.edu!tut.cis.ohio-state.edu!NCIFCRF.GOV!elsie!adoShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!pollux!ti-csl!cs.utexas.edu!tut.cis.ohio-state.edu!NCIFCRF.GOV!elsie!ado From: elsie!ado@NCIFCRF.GOV (Arthur David Olson) Newsgroups: gnu.gcc.bug Subject: Gnu C 1.28's assert.h and DPANS don't mix Message-ID: <8809201942.AA19209@elsie.UUCP> Date: 20 Sep 88 19:42:30 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 69