Warning and error messages output is selectable via commandline options
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5613 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5b49cee830
commit
6c61bbf852
6 changed files with 117 additions and 29 deletions
|
|
@ -1,5 +1,18 @@
|
|||
Version 1.3.21 (in progress)
|
||||
==================================
|
||||
01/10/2004: cheetah (William Fulton)
|
||||
The output format for both warnings and errors can be selected for
|
||||
integration with your favourite IDE/editor. Editors and IDEs can usually
|
||||
parse error messages and if in the appropriate format will easily take you
|
||||
directly to the source of the error. The standard format is used by
|
||||
default except on Windows where the Microsoft format is used by default.
|
||||
These can be overridden using command line options, for example:
|
||||
|
||||
$ swig -python -Fstandard example.i
|
||||
example.i:4: Syntax error in input.
|
||||
$ swig -python -Fmicrosoft example.i
|
||||
example.i(4): Syntax error in input.
|
||||
|
||||
01/09/2004: beazley
|
||||
Fixed [ 871909 ] simple namespace problem.
|
||||
This was a problem using anonymous structures in a namespace.
|
||||
|
|
|
|||
|
|
@ -107,16 +107,18 @@ following options and a filename like this:
|
|||
-tcl Generate Tcl wrappers
|
||||
-xml Generate XML wrappers
|
||||
-c++ Enable C++ parsing
|
||||
-D<em>symbol</em> Define a preprocessor symbol
|
||||
-Fstandard Display error/warning messages in commonly used format
|
||||
-Fmicrosoft Display error/warning messages in Microsoft format
|
||||
-help Display all options
|
||||
-I<em>dir</em> Add a directory to the file include path
|
||||
-l<em>file</em> Include a SWIG library file.
|
||||
-module <em>name</em> Set the name of the SWIG module
|
||||
-noruntime Generate raw wrapper code (omit supporting code)
|
||||
-o <em>outfile</em> Name of output file
|
||||
-outdir <em>dir</em> Set language specific files output directory
|
||||
-module <em>name</em> Set the name of the SWIG module
|
||||
-D<em>symbol</em> Define a preprocessor symbol
|
||||
-version Show SWIG version number
|
||||
-swiglib Show location of SWIG library
|
||||
-help Display all options
|
||||
-version Show SWIG version number
|
||||
|
||||
</pre></blockquote>
|
||||
|
||||
|
|
@ -2655,4 +2657,4 @@ The bottom line: don't do this.
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : August 7, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -13,17 +13,18 @@
|
|||
<li><a href="#n4">Enabling additional warnings</a>
|
||||
<li><a href="#n5">Issuing a warning message</a>
|
||||
<li><a href="#n6">Commentary</a>
|
||||
<li><a href="#n7">Warning number reference</a>
|
||||
<li><a href="#n7">Message output format</a>
|
||||
<li><a href="#n8">Warning number reference</a>
|
||||
<ul>
|
||||
<li><a href="#n8">Deprecated features (100-199)</a>
|
||||
<li><a href="#n9">Preprocessor (200-299)</a>
|
||||
<li><a href="#n10">C/C++ Parser (300-399)</a>
|
||||
<li><a href="#n11">Types and typemaps (400-499) </a>
|
||||
<li><a href="#n12">Code generation (500-599)</a>
|
||||
<li><a href="#n13">Language module specific (800-899) </a>
|
||||
<li><a href="#n14">User defined (900-999)</a>
|
||||
<li><a href="#n9">Deprecated features (100-199)</a>
|
||||
<li><a href="#n10">Preprocessor (200-299)</a>
|
||||
<li><a href="#n11">C/C++ Parser (300-399)</a>
|
||||
<li><a href="#n12">Types and typemaps (400-499) </a>
|
||||
<li><a href="#n13">Code generation (500-599)</a>
|
||||
<li><a href="#n14">Language module specific (800-899) </a>
|
||||
<li><a href="#n15">User defined (900-999)</a>
|
||||
</ul>
|
||||
<li><a href="#n15">History</a>
|
||||
<li><a href="#n16">History</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -221,10 +222,27 @@ no obvious recovery. There is no mechanism for suppressing error
|
|||
messages or handling errors as warnings---you must make changes to
|
||||
the input file to fix the problem.
|
||||
|
||||
<a name="n7"></a><H2>12.6 Warning number reference</H2>
|
||||
<a name="n7"></a><H2>12.6 Message output format</H2>
|
||||
|
||||
|
||||
<a name="n8"></a><H3>12.6.1 Deprecated features (100-199)</H3>
|
||||
The output format for both warnings and errors can be selected for
|
||||
integration with your favourite IDE/editor. Editors and IDEs can usually parse
|
||||
error messages and if in the appropriate format will easily take you
|
||||
directly to the source of the error. The standard format is used by
|
||||
default except on Windows where the Microsoft format is used by default.
|
||||
These can be overridden using command line options, for example:
|
||||
|
||||
<blockquote><pre>
|
||||
$ swig -python -Fstandard example.i
|
||||
example.i:4: Syntax error in input.
|
||||
$ swig -python -Fmicrosoft example.i
|
||||
example.i(4): Syntax error in input.
|
||||
</pre></blockquote>
|
||||
|
||||
<a name="n8"></a><H2>12.7 Warning number reference</H2>
|
||||
|
||||
|
||||
<a name="n9"></a><H3>12.7.1 Deprecated features (100-199)</H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -250,7 +268,7 @@ the input file to fix the problem.
|
|||
<li>120. Deprecated command line option (-c).
|
||||
</ul>
|
||||
|
||||
<a name="n9"></a><H3>12.6.2 Preprocessor (200-299)</H3>
|
||||
<a name="n10"></a><H3>12.7.2 Preprocessor (200-299)</H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -258,7 +276,7 @@ the input file to fix the problem.
|
|||
<li>202. Could not evaluate 'expr'.
|
||||
</ul>
|
||||
|
||||
<a name="n10"></a><H3>12.6.3 C/C++ Parser (300-399)</H3>
|
||||
<a name="n11"></a><H3>12.7.3 C/C++ Parser (300-399)</H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -331,7 +349,7 @@ the input file to fix the problem.
|
|||
<li>395. operator delete[] ignored.
|
||||
</ul>
|
||||
|
||||
<a name="n11"></a><H3>12.6.4 Types and typemaps (400-499) </H3>
|
||||
<a name="n12"></a><H3>12.7.4 Types and typemaps (400-499) </H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -353,7 +371,7 @@ the input file to fix the problem.
|
|||
<li>468. No 'throw' typemap defined for exception type 'type'.
|
||||
</ul>
|
||||
|
||||
<a name="n12"></a><H3>12.6.5 Code generation (500-599)</H3>
|
||||
<a name="n13"></a><H3>12.7.5 Code generation (500-599)</H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -372,7 +390,7 @@ the input file to fix the problem.
|
|||
<li>513. Can't generate wrappers for unnamed struct/class.
|
||||
</ul>
|
||||
|
||||
<a name="n13"></a><H3>12.6.6 Language module specific (800-899) </H3>
|
||||
<a name="n14"></a><H3>12.7.6 Language module specific (800-899) </H3>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
@ -403,12 +421,12 @@ the input file to fix the problem.
|
|||
<li>838. No csin typemap defined for <em>type</em> (C#).
|
||||
</ul>
|
||||
|
||||
<a name="n14"></a><H3>12.6.7 User defined (900-999)</H3>
|
||||
<a name="n15"></a><H3>12.7.7 User defined (900-999)</H3>
|
||||
|
||||
|
||||
These numbers can be used by your own application.
|
||||
|
||||
<a name="n15"></a><H2>12.7 History</H2>
|
||||
<a name="n16"></a><H2>12.8 History</H2>
|
||||
|
||||
|
||||
The ability to control warning messages was first added to SWIG-1.3.12.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ extern "C" {
|
|||
extern String *ModuleName;
|
||||
}
|
||||
|
||||
static char *usage = (char*)"\
|
||||
static const char *usage1 = (const char*)"\
|
||||
\nGeneral Options\n\
|
||||
-c++ - Enable C++ processing\n\
|
||||
-co - Check a file out of the SWIG library\n\
|
||||
|
|
@ -57,6 +57,8 @@ static char *usage = (char*)"\
|
|||
-E - Preprocess only, does not generate wrapper code\n\
|
||||
-fcompact - Compile in compact mode\n\
|
||||
-fvirtual - Compile in virtual elimination mode\n\
|
||||
-Fstandard - Display error/warning messages in commonly used format\n\
|
||||
-Fmicrosoft - Display error/warning messages in Microsoft format\n\
|
||||
-help - This output\n\
|
||||
-I<dir> - Look for SWIG files in <dir>\n\
|
||||
-ignoremissing - Ignore missing include files\n\
|
||||
|
|
@ -65,6 +67,9 @@ static char *usage = (char*)"\
|
|||
-l<ifile> - Include SWIG library file <ifile>\n\
|
||||
-M - List all dependencies \n\
|
||||
-MM - List dependencies, but omit files in SWIG library\n\
|
||||
";
|
||||
// usage string split in two otherwise string is too big for some compilers
|
||||
static const char *usage2 = (const char*)"\
|
||||
-makedefault - Create default constructors/destructors (the default)\n\
|
||||
-module <name> - Set module name to <name>\n\
|
||||
-nocontract - Turn off contract checking \n\
|
||||
|
|
@ -484,8 +489,15 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
} else if (strcmp(argv[i],"-dump_memory") == 0) {
|
||||
memory_debug =1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-Fstandard") == 0) {
|
||||
Swig_error_msg_format(EMF_STANDARD);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-Fmicrosoft") == 0) {
|
||||
Swig_error_msg_format(EMF_MICROSOFT);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
fputs(usage,stderr);
|
||||
fputs(usage1,stderr);
|
||||
fputs(usage2,stderr);
|
||||
Swig_mark_arg(i);
|
||||
help = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,16 @@ char cvsroot_error_c[] = "$Header$";
|
|||
* is reenabled.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define DEFAULT_ERROR_MSG_FORMAT EMF_MICROSOFT
|
||||
#else
|
||||
# define DEFAULT_ERROR_MSG_FORMAT EMF_STANDARD
|
||||
#endif
|
||||
static ErrorMessageFormat msg_format = DEFAULT_ERROR_MSG_FORMAT;
|
||||
static int silence = 0; /* Silent operation */
|
||||
static String *filter = 0; /* Warning filter */
|
||||
static int warnall = 0;
|
||||
static int nwarning = 0;
|
||||
static int nwarning = 0;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_warning()
|
||||
|
|
@ -84,9 +90,25 @@ Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt
|
|||
}
|
||||
if (warnall || wrn) {
|
||||
if (wnum) {
|
||||
Printf(stderr,"%s:%d: Warning(%d): ", filename, line, wnum);
|
||||
switch (msg_format) {
|
||||
case EMF_MICROSOFT:
|
||||
Printf(stderr,"%s(%d): Warning(%d): ", filename, line, wnum);
|
||||
break;
|
||||
case EMF_STANDARD:
|
||||
default:
|
||||
Printf(stderr,"%s:%d: Warning(%d): ", filename, line, wnum);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Printf(stderr,"%s:%d: Warning: ", filename, line, wnum);
|
||||
switch (msg_format) {
|
||||
case EMF_MICROSOFT:
|
||||
Printf(stderr,"%s(%d): Warning: ", filename, line);
|
||||
break;
|
||||
case EMF_STANDARD:
|
||||
default:
|
||||
Printf(stderr,"%s:%d: Warning: ", filename, line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Printf(stderr,"%s",msg);
|
||||
nwarning++;
|
||||
|
|
@ -111,7 +133,15 @@ Swig_error(const String_or_char *filename, int line, const char *fmt, ...) {
|
|||
|
||||
va_start(ap,fmt);
|
||||
if (line > 0) {
|
||||
Printf(stderr,"%s:%d: ", filename, line);
|
||||
switch (msg_format) {
|
||||
case EMF_MICROSOFT:
|
||||
Printf(stderr,"%s(%d): ", filename, line);
|
||||
break;
|
||||
case EMF_STANDARD:
|
||||
default:
|
||||
Printf(stderr,"%s:%d: ", filename, line);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Printf(stderr,"%s:EOF: ", filename);
|
||||
}
|
||||
|
|
@ -197,3 +227,13 @@ Swig_warn_count(void) {
|
|||
return nwarning;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_error_msg_format()
|
||||
*
|
||||
* Set the type of error/warning message display
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
Swig_error_msg_format(ErrorMessageFormat format) {
|
||||
msg_format = format;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -415,6 +415,8 @@ extern void Swig_warn(const char *filename, int line, const char *msg);
|
|||
|
||||
#define WARNING(msg) Swig_warn(__FILE__,__LINE__,msg)
|
||||
|
||||
typedef enum { EMF_STANDARD, EMF_MICROSOFT } ErrorMessageFormat;
|
||||
|
||||
extern void Swig_warning(int num, const String_or_char *filename, int line, const char *fmt, ...);
|
||||
extern void Swig_error(const String_or_char *filename, int line, const char *fmt, ...);
|
||||
extern int Swig_error_count(void);
|
||||
|
|
@ -422,6 +424,7 @@ extern void Swig_error_silent(int s);
|
|||
extern void Swig_warnfilter(const String_or_char *wlist, int val);
|
||||
extern void Swig_warnall(void);
|
||||
extern int Swig_warn_count(void);
|
||||
extern void Swig_error_msg_format(ErrorMessageFormat format);
|
||||
|
||||
/* --- C Wrappers --- */
|
||||
extern String *Swig_cparm_name(Parm *p, int i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue