| 1 |
/* btest.c -- Filename header for libbacktrace library |
| 2 |
Copyright (C) 2012-2018 Free Software Foundation, Inc. |
| 3 |
Written by Ian Lance Taylor, Google. |
| 4 |
|
| 5 |
Redistribution and use in source and binary forms, with or without |
| 6 |
modification, are permitted provided that the following conditions are |
| 7 |
met: |
| 8 |
|
| 9 |
(1) Redistributions of source code must retain the above copyright |
| 10 |
notice, this list of conditions and the following disclaimer. |
| 11 |
|
| 12 |
(2) Redistributions in binary form must reproduce the above copyright |
| 13 |
notice, this list of conditions and the following disclaimer in |
| 14 |
the documentation and/or other materials provided with the |
| 15 |
distribution. |
| 16 |
|
| 17 |
(3) The name of the author may not be used to |
| 18 |
endorse or promote products derived from this software without |
| 19 |
specific prior written permission. |
| 20 |
|
| 21 |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 22 |
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 23 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 |
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 25 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 26 |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 27 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 29 |
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 30 |
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 31 |
POSSIBILITY OF SUCH DAMAGE. */ |
| 32 |
|
| 33 |
#ifndef GCC_VERSION |
| 34 |
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) |
| 35 |
#endif |
| 36 |
|
| 37 |
#if (GCC_VERSION < 2007) |
| 38 |
# define __attribute__(x) |
| 39 |
#endif |
| 40 |
|
| 41 |
#ifndef ATTRIBUTE_UNUSED |
| 42 |
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 43 |
#endif |
| 44 |
|
| 45 |
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) |
| 46 |
# define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') |
| 47 |
# define HAS_DRIVE_SPEC(f) ((f)[0] != '\0' && (f)[1] == ':') |
| 48 |
# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f)) |
| 49 |
#else |
| 50 |
# define IS_DIR_SEPARATOR(c) ((c) == '/') |
| 51 |
# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) |
| 52 |
#endif |