Allow using things that were deprecated in gtk+-3.22.
[freeciv.git] / utility / deprecations.c
blobee5b18724fe8ec2e0c53494fb8e8c0d3cf7f709f
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 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif /* HAVE_CONFIG_H */
18 #include "fc_prehdrs.h"
20 #include <stdarg.h>
22 /* utility */
23 #include "log.h"
24 #include "shared.h"
26 #include "deprecations.h"
28 static deprecation_warn_callback depr_cb = NULL;
30 static bool depr_warns_enabled = FALSE;
32 /************************************************************************
33 Enable deprecation warnings.
34 ************************************************************************/
35 void deprecation_warnings_enable(void)
37 depr_warns_enabled = TRUE;
40 /************************************************************************
41 Return whether deprecation warnings are currently enabled.
42 ************************************************************************/
43 bool are_deprecation_warnings_enabled(void)
45 return depr_warns_enabled;
48 /************************************************************************
49 Set callback to call when deprecation warnings are issued
50 ************************************************************************/
51 void deprecation_warn_cb_set(deprecation_warn_callback new_cb)
53 depr_cb = new_cb;
56 /************************************************************************
57 Log the deprecation warning
58 ************************************************************************/
59 void do_log_deprecation(const char *format, ...)
61 va_list args;
62 char buf[1024];
64 va_start(args, format);
65 vdo_log(__FILE__, __FUNCTION__, __FC_LINE__, FALSE, LOG_DEPRECATION,
66 buf, sizeof(buf), format, args);
67 if (depr_cb != NULL) {
68 depr_cb(buf);
70 va_end(args);