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)
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 ***********************************************************************/
15 #include <fc_config.h>
16 #endif /* HAVE_CONFIG_H */
18 #include "fc_prehdrs.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
)
56 /************************************************************************
57 Log the deprecation warning
58 ************************************************************************/
59 void do_log_deprecation(const char *format
, ...)
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
) {