diff options
| author | Paul Eggert | 2013-10-03 00:06:52 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-10-03 00:06:52 -0700 |
| commit | 0a858ebfc57a072ae8ab65f509d8a4901a2ec073 (patch) | |
| tree | dd81bcdf11f3d3efa32ffe00f7cdc90d3c1144d9 /lib/verify.h | |
| parent | b52f569dcfc5c2e1b764c89d27ea8699a44228e6 (diff) | |
| download | emacs-0a858ebfc57a072ae8ab65f509d8a4901a2ec073.tar.gz emacs-0a858ebfc57a072ae8ab65f509d8a4901a2ec073.zip | |
Merge from gnulib.
* src/conf_post.h (__has_builtin, assume): Remove; gnulib now does these.
* src/lisp.h: Include <verify.h>, for 'assume'.
This also incorpoprates:
2013-10-02 verify: new macro 'assume'
2013-09-26 dup2, dup3: work around another cygwin crasher
2013-09-26 getdtablesize: work around cygwin issue
Diffstat (limited to 'lib/verify.h')
| -rw-r--r-- | lib/verify.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/verify.h b/lib/verify.h index d42d0750ee1..bf40b028c92 100644 --- a/lib/verify.h +++ b/lib/verify.h | |||
| @@ -250,6 +250,30 @@ template <int w> | |||
| 250 | 250 | ||
| 251 | #define verify(R) _GL_VERIFY (R, "verify (" #R ")") | 251 | #define verify(R) _GL_VERIFY (R, "verify (" #R ")") |
| 252 | 252 | ||
| 253 | #ifndef __has_builtin | ||
| 254 | # define __has_builtin(x) 0 | ||
| 255 | #endif | ||
| 256 | |||
| 257 | /* Assume that R always holds. This lets the compiler optimize | ||
| 258 | accordingly. R should not have side-effects; it may or may not be | ||
| 259 | evaluated. Behavior is undefined if R is false. */ | ||
| 260 | |||
| 261 | #if (__has_builtin (__builtin_unreachable) \ | ||
| 262 | || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) | ||
| 263 | # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) | ||
| 264 | #elif 1200 <= _MSC_VER | ||
| 265 | # define assume(R) __assume (R) | ||
| 266 | #elif (defined lint \ | ||
| 267 | && (__has_builtin (__builtin_trap) \ | ||
| 268 | || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) | ||
| 269 | /* Doing it this way helps various packages when configured with | ||
| 270 | --enable-gcc-warnings, which compiles with -Dlint. It's nicer | ||
| 271 | when 'assume' silences warnings even with older GCCs. */ | ||
| 272 | # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) | ||
| 273 | #else | ||
| 274 | # define assume(R) ((void) (0 && (R))) | ||
| 275 | #endif | ||
| 276 | |||
| 253 | /* @assert.h omit end@ */ | 277 | /* @assert.h omit end@ */ |
| 254 | 278 | ||
| 255 | #endif | 279 | #endif |