diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-08-27 16:20:45 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-08-27 16:20:45 +0000 |
commit | 06c37c965a32bf125f32111fac25707bee54708a (patch) | |
tree | e2fce412e85b16b97075f73dc19c83b703a40a39 /gcc/system.h | |
parent | 9d64df18fd9175749aea2742096b172f59a5ebeb (diff) | |
download | gcc-06c37c965a32bf125f32111fac25707bee54708a.zip gcc-06c37c965a32bf125f32111fac25707bee54708a.tar.gz gcc-06c37c965a32bf125f32111fac25707bee54708a.tar.bz2 |
configure.ac: Add ENABLE_ASSERT_CHECKING control.
* configure.ac: Add ENABLE_ASSERT_CHECKING control.
Add is_release variable, use it for --enable-werror and
--enable-checking defaults.
* system.h (gcc_assert, gcc_unreachable): New.
* doc/install.texi (--enable-checking): Update.
* configure, config.in: Rebuilt.
From-SVN: r86666
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h index 14dd1de..934a332 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -505,6 +505,19 @@ extern int snprintf (char *, size_t, const char *, ...); extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__) +/* Use gcc_assert(EXPR) to test invariants. */ +#if ENABLE_ASSERT_CHECKING +#define gcc_assert(EXPR) \ + ((void)(__builtin_expect (!(EXPR), 0) \ + ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0)) +#else +#define gcc_assert(EXPR) ((void)0) +#endif + +/* Use gcc_unreachable() to mark unreachable locations (like an + unreachable default case of a switch. Do not use gcc_assert(0). */ +#define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__)) + /* Provide a fake boolean type. We make no attempt to use the C99 _Bool, as it may not be available in the bootstrap compiler, and even if it is, it is liable to be buggy. |