| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __FC_FEATURES_H |
| 24 |
#define __FC_FEATURES_H |
| 25 |
|
| 26 |
// *** Definitions to improve compatibility with GCC-specific built-ins |
| 27 |
// and GNU-based code *** |
| 28 |
|
| 29 |
#ifdef __FRAMAC__ |
| 30 |
#define __PUSH_FC_STDLIB #pragma fc_stdlib(push,__FILE__) |
| 31 |
#define __POP_FC_STDLIB #pragma fc_stdlib(pop) |
| 32 |
#else |
| 33 |
#define __PUSH_FC_STDLIB |
| 34 |
#define __POP_FC_STDLIB |
| 35 |
#endif |
| 36 |
|
| 37 |
#ifdef __cplusplus |
| 38 |
# define __BEGIN_DECLS extern "C" { |
| 39 |
# define __END_DECLS } |
| 40 |
#else |
| 41 |
# define __BEGIN_DECLS |
| 42 |
# define __END_DECLS |
| 43 |
#endif |
| 44 |
|
| 45 |
#undef __LEAF |
| 46 |
#define __LEAF |
| 47 |
#undef __LEAF_ATTR |
| 48 |
#define __LEAF_ATTR |
| 49 |
|
| 50 |
#undef __THROW |
| 51 |
#undef __THROWNL |
| 52 |
#undef __NTH |
| 53 |
#if defined __cplusplus |
| 54 |
# define __THROW throw () |
| 55 |
# define __THROWNL throw () |
| 56 |
# define __NTH(fct) fct throw () |
| 57 |
#else |
| 58 |
# define __THROW |
| 59 |
# define __THROWNL |
| 60 |
# define __NTH(fct) fct |
| 61 |
#endif |
| 62 |
|
| 63 |
// Frama-C does not support GCC's __builtin_object_size. |
| 64 |
// To improve compatibility with some codebases, |
| 65 |
// we define it anyway, but it always returns -1, as if |
| 66 |
// the compiler were unable to statically determine |
| 67 |
// the object size (we only consider the cases where type |
| 68 |
// is either 0 or 1). |
| 69 |
// Note that for some built-ins, we force them to our definition, |
| 70 |
// while others we leave unmodified if they exist |
| 71 |
#undef __builtin_object_size |
| 72 |
#define __builtin_object_size (ptr, type) ((size_t)-1) |
| 73 |
#undef __bos |
| 74 |
#define __bos(ptr) __builtin_object_size (ptr, 0) |
| 75 |
#undef __bos0 |
| 76 |
#define __bos0(ptr) __builtin_object_size (ptr, 0) |
| 77 |
|
| 78 |
#undef __warndecl |
| 79 |
#define __warndecl(name, msg) extern void name (void) |
| 80 |
#undef __warnattr |
| 81 |
#define __warnattr(msg) |
| 82 |
#undef __errordecl |
| 83 |
#define __errordecl(name, msg) extern void name (void) |
| 84 |
|
| 85 |
#undef __nonnull |
| 86 |
#define __nonnull(args...) |
| 87 |
|
| 88 |
#ifndef __attribute_deprecated__ |
| 89 |
# define __attribute_deprecated__ __attribute__((__deprecated__)) |
| 90 |
#endif |
| 91 |
#ifndef __attribute_format_arg__ |
| 92 |
# define __attribute_format_arg__(x) __attribute__((__format_arg__(x))) |
| 93 |
#endif |
| 94 |
#ifndef __attribute_const__ |
| 95 |
# define __attribute_const__ __attribute__((__const__)) |
| 96 |
#endif |
| 97 |
#ifndef __attribute_malloc__ |
| 98 |
# define __attribute_malloc__ __attribute__((__malloc__)) |
| 99 |
#endif |
| 100 |
#ifndef __attribute_artificial__ |
| 101 |
# define __attribute_artificial__ /* Ignore */ |
| 102 |
#endif |
| 103 |
#ifndef __attribute_pure__ |
| 104 |
# define __attribute_pure__ /* Ignore */ |
| 105 |
#endif |
| 106 |
|
| 107 |
#undef __attribute_warn_unused_result__ |
| 108 |
#define __attribute_warn_unused_result__ /* empty */ |
| 109 |
#ifndef __wur |
| 110 |
# define __wur /* Ignore */ |
| 111 |
#endif |
| 112 |
|
| 113 |
#define restrict __restrict |
| 114 |
#define __restrict__ __restrict |
| 115 |
|
| 116 |
#define __USE_ISOC99 1 |
| 117 |
|
| 118 |
// When linking code including Frama-C's libc, we avoid adding 'extern' |
| 119 |
// to some variable declarations. In this case, __FC_EXTERN is defined to |
| 120 |
// the empty string. Otherwise, define it to 'extern'. |
| 121 |
#ifndef __FC_EXTERN |
| 122 |
#define __FC_EXTERN extern |
| 123 |
#endif |
| 124 |
|
| 125 |
// C11 §6.10.8.3 Conditional feature macros: Frama-C does not support complex.h |
| 126 |
#ifndef __STDC_NO_COMPLEX__ |
| 127 |
#define __STDC_NO_COMPLEX__ |
| 128 |
#endif |
| 129 |
|
| 130 |
/* end __FC_FEATURES_H */ |
| 131 |
#endif |