| 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 |
// Non-POSIX and not in the C ISO standard; this file is defined in the |
| 24 |
// GNU libc. |
| 25 |
|
| 26 |
#ifndef __FC_ERR_H |
| 27 |
#define __FC_ERR_H |
| 28 |
|
| 29 |
#include "features.h" |
| 30 |
__PUSH_FC_STDLIB |
| 31 |
|
| 32 |
#include "__fc_string_axiomatic.h" |
| 33 |
#include "stdarg.h" |
| 34 |
|
| 35 |
__BEGIN_DECLS |
| 36 |
|
| 37 |
// TODO: extend Variadic to handle these functions, or provide C stubs. |
| 38 |
// Currently, given their limited usage and non-standard status, this |
| 39 |
// lightweight approach seems better suited. |
| 40 |
|
| 41 |
/*@ |
| 42 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 43 |
assigns \exit_status \from eval; |
| 44 |
ensures never_terminates: \false; |
| 45 |
*/ |
| 46 |
void err(int eval, const char *fmt, ...); |
| 47 |
|
| 48 |
/*@ |
| 49 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 50 |
assigns \exit_status \from eval; |
| 51 |
ensures never_terminates: \false; |
| 52 |
*/ |
| 53 |
void errx(int eval, const char *fmt, ...); |
| 54 |
|
| 55 |
/*@ |
| 56 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 57 |
assigns \nothing; |
| 58 |
*/ |
| 59 |
void warn(const char *fmt, ...); |
| 60 |
|
| 61 |
/*@ |
| 62 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 63 |
assigns \nothing; |
| 64 |
*/ |
| 65 |
void warnx(const char *fmt, ...); |
| 66 |
|
| 67 |
/*@ |
| 68 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 69 |
assigns \exit_status \from eval; |
| 70 |
ensures never_terminates: \false; |
| 71 |
*/ |
| 72 |
void verr(int eval, const char *fmt, va_list args); |
| 73 |
|
| 74 |
/*@ |
| 75 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 76 |
assigns \exit_status \from eval; |
| 77 |
ensures never_terminates: \false; |
| 78 |
*/ |
| 79 |
void verrx(int eval, const char *fmt, va_list args); |
| 80 |
|
| 81 |
/*@ |
| 82 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 83 |
assigns \nothing; |
| 84 |
*/ |
| 85 |
void vwarn(const char *fmt, va_list args); |
| 86 |
|
| 87 |
/*@ |
| 88 |
requires fmt_valid_read_or_null: valid_read_string(fmt) || fmt == \null; |
| 89 |
assigns \nothing; |
| 90 |
*/ |
| 91 |
void vwarnx(const char *fmt, va_list args); |
| 92 |
|
| 93 |
__END_DECLS |
| 94 |
|
| 95 |
__POP_FC_STDLIB |
| 96 |
#endif |