It's not possible to disable all warnings but one (or n, in the general case). Suppose one wants to enable all warnings except 509. When -Wall is turned on, all other warning filters are ignored, so -Wall -w509 cannot be used.
So, the next approach one might try would be to use -w509,+202,+309,+403,+512,+321,+322, to disable 509 and enable the warnings that swig disables by default. However, because Swig_warnfilter() prepends to the warning filter list, the warn filter starts as
then gets set to
Now, warning 509 does indeed get ignored. However, 202, for example, is still ignored. The reason it is ignored is that Swig_warning scans through the warning filter for all the ones matching the warning number, and uses the *last* match found. So, it uses the -202 filter because it comes after the +202 filter.
One fix would be to break out of the loop in Swig_warning() when the first match is found.
It would be great if there was an option like -Wall that only cleared the default warn filter, instead of disabling all warning filters.
Log in to post a comment.