diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-29 04:14:26 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-29 04:14:26 +0200 |
commit | efed0aa7dd6157f3c4e16cb022eefa3ba942e470 (patch) | |
tree | a498f486f4789832d0c9639c7a7bb5c2a0487973 | |
parent | add stdalign.h (diff) | |
download | slibc-efed0aa7dd6157f3c4e16cb022eefa3ba942e470.tar.gz slibc-efed0aa7dd6157f3c4e16cb022eefa3ba942e470.tar.bz2 slibc-efed0aa7dd6157f3c4e16cb022eefa3ba942e470.tar.xz |
only use __attributes__ if compiling with gcc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | include/assert.h | 5 | ||||
-rw-r--r-- | include/slibc/features.h | 35 |
2 files changed, 39 insertions, 1 deletions
diff --git a/include/assert.h b/include/assert.h index 7f44222..e5a963d 100644 --- a/include/assert.h +++ b/include/assert.h @@ -20,6 +20,9 @@ #include <slibc/version.h> +#include <slibc/features.h> + + /* The `assert` macro shall be redefined according to the the * current state of `NDEBUF` each time <assert.h> is included. */ @@ -86,7 +89,7 @@ __USE_GNU * @param line The line in the source code whence the assertion was made * @param func The function in the source code whence the assertion was made */ -void __attribute__((noreturn, nonnull(3, 4, 5))) +void __GCC_ONLY(__attribute__((noreturn, nonnull(3, 4, 5)))) __assert_fail(const char* expression, int errnum, const char* file, int line, const char* func); diff --git a/include/slibc/features.h b/include/slibc/features.h new file mode 100644 index 0000000..a755f71 --- /dev/null +++ b/include/slibc/features.h @@ -0,0 +1,35 @@ +/** + * slibc — Yet another C library + * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef _SLIBC_FEATURES_H +#define _SLIBC_FEATURES_H + + + +/** + * Macro used to exclude code unless GCC is used. + */ +#if defined(__GNUC__) +# define __GCC_ONLY(...) __VA_ARGS__ +#else +# define __GCC_ONLY(...) /* ignore */ +#endif + + + +#endif + |