| 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_ALLOCA |
| 24 |
#define __FC_ALLOCA |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
#include "stdlib.h" |
| 28 |
|
| 29 |
__BEGIN_DECLS |
| 30 |
|
| 31 |
/*@ ghost extern int __fc_stack_status; */ |
| 32 |
|
| 33 |
// Note: alloca is considered to never fail, unlike malloc |
| 34 |
// Currently, ACSL does not allow specifying that the memory allocated by |
| 35 |
// alloca must be freed at the end of the execution of its caller, |
| 36 |
// therefore this responsibility is given to the user of this function. |
| 37 |
/*@ |
| 38 |
allocates \result; |
| 39 |
assigns __fc_stack_status \from size, __fc_stack_status; |
| 40 |
assigns \result \from indirect:size, indirect:__fc_stack_status; |
| 41 |
ensures allocation: \fresh(\result,size); |
| 42 |
*/ |
| 43 |
extern void *alloca(size_t size); |
| 44 |
|
| 45 |
__END_DECLS |
| 46 |
__POP_FC_STDLIB |
| 47 |
#endif |