~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Doc/Manual/Warnings.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-06 10:27:08 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206102708-t37t62i45n595w0e
Tags: 1.3.33-2ubuntu1
* Merge with Debian; remaining changes:
  - Drop support for pike.
  - Use python2.5 instead of python2.4.
  - Clean Runtime/ as well.
  - Force a few environment variables.
* debian/Rules (clean): Remove Lib/ocaml/swigp4.ml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
<ul>
13
13
<li><a href="#Warnings_nn2">Introduction</a>
14
14
<li><a href="#Warnings_suppression">Warning message suppression</a>
15
 
<li><a href="#Warnings_nn4">Enabling additional warnings</a>
 
15
<li><a href="#Warnings_nn4">Enabling extra warnings</a>
16
16
<li><a href="#Warnings_nn5">Issuing a warning message</a>
 
17
<li><a href="#Warnings_symbolic_symbols">Symbolic symbols</a>
17
18
<li><a href="#Warnings_nn6">Commentary</a>
18
19
<li><a href="#Warnings_nn7">Warnings as errors</a>
19
20
<li><a href="#Warnings_nn8">Message output format</a>
100
101
 
101
102
<p>
102
103
The <tt>%warnfilter</tt> directive has the same semantics as other declaration modifiers like 
103
 
<tt>%rename</tt>, <tt>%ignore</tt>, and <tt>%feature</tt>.  For example, if you wanted to
 
104
<tt>%rename</tt>, <tt>%ignore</tt> and <tt>%feature</tt>, see the 
 
105
<a href="Customization.html#features">%feature directive</a> section.  For example, if you wanted to
104
106
suppress a warning for a method in a class hierarchy, you could do this:
105
107
</p>
106
108
 
144
146
your interface.  Ignore the warning messages at your own peril.
145
147
</p>
146
148
 
147
 
<H2><a name="Warnings_nn4"></a>14.3 Enabling additional warnings</H2>
 
149
 
 
150
<H2><a name="Warnings_nn4"></a>14.3 Enabling extra warnings</H2>
148
151
 
149
152
 
150
153
<p>
151
154
Some warning messages are disabled by default and are generated only
152
 
to provide additional diagnostics.  All warning messages can be
153
 
enabled using the <tt>-Wall</tt> option. For example:
 
155
to provide additional diagnostics.  These warnings can be turned on using the
 
156
<tt>-Wextra</tt> option. For example:
154
157
</p>
155
158
 
156
159
<div class="shell">
157
160
<pre>
158
 
% swig -Wall -python example.i
 
161
% swig -Wextra -python example.i
159
162
</pre>
160
163
</div>
161
164
 
162
165
<p>
163
 
When <tt>-Wall</tt> is used, all other warning filters are disabled.
164
 
</p>
165
 
 
166
 
<p>
167
166
To selectively turn on extra warning messages, you can use the directives and options in the
168
167
previous section--simply add a "+" to all warning numbers.  For example:
169
168
</p>
175
174
</div>
176
175
 
177
176
<p>
178
 
or
 
177
or in your interface file use either
179
178
</p>
180
179
 
181
180
<div class="code">
199
198
made using <tt>-w</tt> or <tt>#pragma</tt>.
200
199
</p>
201
200
 
 
201
<p>
 
202
You can of course also enable all warnings and suppress a select few, for example:
 
203
</p>
 
204
 
 
205
<div class="shell">
 
206
<pre>
 
207
% swig -Wextra -w309,452 example.i
 
208
</pre>
 
209
</div>
 
210
 
 
211
<p>
 
212
The warnings on the right take precedence over the warnings on the left, so in the above example <tt>-Wextra</tt> adds numerous warnings including 452, but then <tt>-w309,452</tt> overrides this and so 452 is suppressesed.
 
213
</p>
 
214
 
 
215
<p>
 
216
If you would like all warnings to appear, regardless of the warning filters used, then use the <tt>-Wall</tt> option.
 
217
The <tt>-Wall</tt> option also turns on the extra warnings that <tt>-Wextra</tt> adds, however, it is subtely different. 
 
218
When <tt>-Wall</tt> is used, it also disables all other warning filters, 
 
219
that is, any warnings suppressed or added in <tt>%warnfilter</tt>, <tt>#pragma SWIG nowarn</tt> 
 
220
or the <tt>-w</tt> option.
 
221
</p>
 
222
 
202
223
<H2><a name="Warnings_nn5"></a>14.4 Issuing a warning message</H2>
203
224
 
204
225
 
209
230
 
210
231
<div class="code">
211
232
<pre>
212
 
%warn "750:This is your last warning!"
 
233
%warn "900:This is your last warning!"
213
234
</pre>
214
235
</div>
215
236
 
236
257
 
237
258
<div class="code">
238
259
<pre>
239
 
%typemap(in, warning="751:You are really going to regret this") blah * {
 
260
%typemap(in, warning="901:You are really going to regret this") blah * {
240
261
   ...
241
262
}
242
263
</pre>
246
267
In this case, the warning message will be printed whenever the typemap is actually used.
247
268
</p>
248
269
 
249
 
<H2><a name="Warnings_nn6"></a>14.5 Commentary</H2>
 
270
<H2><a name="Warnings_symbolic_symbols"></a>14.5 Symbolic symbols</H2>
 
271
 
 
272
 
 
273
<p>
 
274
The <tt>swigwarn.swg</tt> file that is installed with SWIG contains symbol constants that could also be
 
275
used in <tt>%warnfilter</tt> and <tt>#pragma SWIG nowarn</tt>.
 
276
For example this file contains the following line:
 
277
</p>
 
278
 
 
279
<div class="code">
 
280
<pre>
 
281
%define SWIGWARN_TYPE_UNDEFINED_CLASS 401 %enddef
 
282
</pre>
 
283
</div>
 
284
 
 
285
<p>
 
286
so <tt>SWIGWARN_TYPE_UNDEFINED_CLASS</tt> could be used instead of 401, for example:
 
287
</p>
 
288
 
 
289
<div class="code">
 
290
<pre>
 
291
#pragma SWIG nowarn=SWIGWARN_TYPE_UNDEFINED_CLASS
 
292
</pre>
 
293
</div>
 
294
 
 
295
<p>
 
296
or 
 
297
</p>
 
298
 
 
299
<div class="code">
 
300
<pre>
 
301
%warnfilter(SWIGWARN_TYPE_UNDEFINED_CLASS) Foo;
 
302
</pre>
 
303
</div>
 
304
 
 
305
<H2><a name="Warnings_nn6"></a>14.6 Commentary</H2>
250
306
 
251
307
 
252
308
<p>
253
309
The ability to suppress warning messages is really only provided for
254
 
advanced users and is not recommended in normal use.  There are no
255
 
plans to provide symbolic names or options that identify specific
256
 
types or groups of warning messages---the numbers must be used
257
 
explicitly.
 
310
advanced users and is not recommended in normal use.  You are advised
 
311
to modify your interface to fix the problems highlighted by the warnings
 
312
wherever possible instead of suppressing warnings.
258
313
</p>
259
314
 
260
315
<p>
264
319
messages.
265
320
</p>
266
321
 
267
 
<H2><a name="Warnings_nn7"></a>14.6 Warnings as errors</H2>
 
322
<H2><a name="Warnings_nn7"></a>14.7 Warnings as errors</H2>
268
323
 
269
324
 
270
325
<p>
273
328
warning is encountered.
274
329
</p>
275
330
 
276
 
<H2><a name="Warnings_nn8"></a>14.7 Message output format</H2>
 
331
<H2><a name="Warnings_nn8"></a>14.8 Message output format</H2>
277
332
 
278
333
 
279
334
<p>
292
347
example.i(4): Syntax error in input.
293
348
</pre></div>
294
349
 
295
 
<H2><a name="Warnings_nn9"></a>14.8 Warning number reference</H2>
296
 
 
297
 
 
298
 
<H3><a name="Warnings_nn10"></a>14.8.1 Deprecated features (100-199)</H3>
 
350
<H2><a name="Warnings_nn9"></a>14.9 Warning number reference</H2>
 
351
 
 
352
 
 
353
<H3><a name="Warnings_nn10"></a>14.9.1 Deprecated features (100-199)</H3>
299
354
 
300
355
 
301
356
<ul>
322
377
<li>121. Deprecated <tt>%name</tt> directive.
323
378
</ul>
324
379
 
325
 
<H3><a name="Warnings_nn11"></a>14.8.2 Preprocessor (200-299)</H3>
 
380
<H3><a name="Warnings_nn11"></a>14.9.2 Preprocessor (200-299)</H3>
326
381
 
327
382
 
328
383
<ul>
330
385
<li>202. Could not evaluate 'expr'.
331
386
</ul>
332
387
 
333
 
<H3><a name="Warnings_nn12"></a>14.8.3 C/C++ Parser (300-399)</H3>
 
388
<H3><a name="Warnings_nn12"></a>14.9.3 C/C++ Parser (300-399)</H3>
334
389
 
335
390
 
336
391
<ul>
404
459
<li>395. operator delete[] ignored.
405
460
</ul>
406
461
 
407
 
<H3><a name="Warnings_nn13"></a>14.8.4 Types and typemaps (400-499) </H3>
 
462
<H3><a name="Warnings_nn13"></a>14.9.4 Types and typemaps (400-499) </H3>
408
463
 
409
464
 
410
465
<ul>
429
484
<li>471. Unable to use return type <em>type</em> in director method
430
485
</ul>
431
486
 
432
 
<H3><a name="Warnings_nn14"></a>14.8.5 Code generation (500-599)</H3>
 
487
<H3><a name="Warnings_nn14"></a>14.9.5 Code generation (500-599)</H3>
433
488
 
434
489
 
435
490
<ul>
451
506
<li>516. Overloaded method <em>declaration</em> ignored. Method <em>declaration</em> at <em>file</em>:<em>line</em> used.
452
507
<li>517. 
453
508
<li>518. Portability warning: File <em>file1</em> will be overwritten by <em>file2</em> on case insensitive filesystems such as Windows' FAT32 and NTFS unless the class/module name is renamed.
 
509
<li>519. %template() contains no name. Template method ignored: <em>declaration</em>
454
510
</ul>
455
511
 
456
 
<H3><a name="Warnings_nn15"></a>14.8.6 Language module specific (800-899) </H3>
 
512
<H3><a name="Warnings_nn15"></a>14.9.6 Language module specific (800-899) </H3>
457
513
 
458
514
 
459
515
<ul>
502
558
<li>871. Unrecognized pragma <em>pragma</em>.   (Php).
503
559
</ul>
504
560
 
505
 
<H3><a name="Warnings_nn16"></a>14.8.7 User defined (900-999)</H3>
 
561
<H3><a name="Warnings_nn16"></a>14.9.7 User defined (900-999)</H3>
506
562
 
507
563
 
508
564
<p>
509
565
These numbers can be used by your own application.
510
566
</p>
511
567
 
512
 
<H2><a name="Warnings_nn17"></a>14.9 History</H2>
 
568
<H2><a name="Warnings_nn17"></a>14.10 History</H2>
513
569
 
514
570
 
515
571
<p>