webperimental: killstack decides stack protects.
[freeciv.git] / utility / deprecations.h
blobc626532ad49fdbcaabbd448a6c581a3c91f374ee
1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifndef FC__DEPRECATIONS_H
15 #define FC__DEPRECATIONS_H
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
21 /* utility */
22 #include "log.h"
24 typedef void (*deprecation_warn_callback)(const char *msg);
26 #define LOG_DEPRECATION LOG_WARN
28 void deprecation_warn_cb_set(deprecation_warn_callback new_cb);
29 void deprecation_warnings_enable(void);
30 bool are_deprecation_warnings_enabled(void);
32 void do_log_deprecation(const char *format, ...);
34 #define log_deprecation(message, ...) \
35 do { \
36 if (are_deprecation_warnings_enabled()) { \
37 do_log_deprecation(message, ## __VA_ARGS__); \
38 } \
39 } while (FALSE);
41 #define log_deprecation_alt(altlvl, message, ...) \
42 do { \
43 if (are_deprecation_warnings_enabled()) { \
44 do_log_deprecation(message, ## __VA_ARGS__); \
45 } else { \
46 log_base(altlvl, message, ## __VA_ARGS__); \
47 } \
48 } while (FALSE);
50 #define log_deprecation_always(message, ...) \
51 do_log_deprecation(message, ## __VA_ARGS__);
53 #ifdef __cplusplus
55 #endif /* __cplusplus */
57 #endif /* FC__DEPRECATIONS_H */