summaryrefslogtreecommitdiff
path: root/Source/Swig/warn.c
blob: 8f577ebfeeccbc6c1df327c5457bd080dff67953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ----------------------------------------------------------------------------- 
 * See the LICENSE file for information on copyright, usage and redistribution
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 *
 * warn.c
 *
 * SWIG warning framework.  This was added to warn developers about 
 * deprecated APIs and other features.
 * ----------------------------------------------------------------------------- */

char cvsroot_warn_c[] = "$Id: warn.c 9604 2006-12-05 21:57:44Z beazley $";

#include "swig.h"

static Hash *warnings = 0;

/* -----------------------------------------------------------------------------
 * Swig_warn()
 * 
 * Issue a warning
 * ----------------------------------------------------------------------------- */

void Swig_warn(const char *filename, int line, const char *msg) {
  String *key;
  if (!warnings) {
    warnings = NewHash();
  }
  key = NewStringf("%s:%d", filename, line);
  if (!Getattr(warnings, key)) {
    Printf(stderr, "swig-dev warning:%s:%d:%s\n", filename, line, msg);
    Setattr(warnings, key, key);
  }
  Delete(key);
}