import source from 1.3.40
[external/swig.git] / Source / Swig / warn.c
1 /* ----------------------------------------------------------------------------- 
2  * See the LICENSE file for information on copyright, usage and redistribution
3  * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4  *
5  * warn.c
6  *
7  * SWIG warning framework.  This was added to warn developers about 
8  * deprecated APIs and other features.
9  * ----------------------------------------------------------------------------- */
10
11 char cvsroot_warn_c[] = "$Id: warn.c 9604 2006-12-05 21:57:44Z beazley $";
12
13 #include "swig.h"
14
15 static Hash *warnings = 0;
16
17 /* -----------------------------------------------------------------------------
18  * Swig_warn()
19  * 
20  * Issue a warning
21  * ----------------------------------------------------------------------------- */
22
23 void Swig_warn(const char *filename, int line, const char *msg) {
24   String *key;
25   if (!warnings) {
26     warnings = NewHash();
27   }
28   key = NewStringf("%s:%d", filename, line);
29   if (!Getattr(warnings, key)) {
30     Printf(stderr, "swig-dev warning:%s:%d:%s\n", filename, line, msg);
31     Setattr(warnings, key, key);
32   }
33   Delete(key);
34 }