Vadim Zeitlin
2016-07-31 10:00:23 UTC
Hi,
I have to admit that even after years of working with SWIG I still often
make mistakes when writing %rename or %ignore directives. Sometimes it's as
stupid as putting them after the declaration of the symbol being renamed,
and sometimes it's more subtle, see https://github.com/swig/swig/issues/757
but in any case it takes me longer than it should to find and fix the
problem and this is mostly due to the fact that it takes time to even
realize that the directive wasn't taken into account in the first place.
I really wish SWIG could help me here, so I wonder if it could be a good
idea to add a warning, which would be given at the end of processing, if a
rename/ignore has never been used? It seems to me that there is no real
reason to have such directives not matching anything, so I believe such
warning would be useful as it would point out unintentional behaviour.
And we would provide some "allow_unused" attribute which could be set to
indicate that some particular directive can really be unused, this would be
useful for at least the directives in the SWIG library files which define
%renames for all the operators in Python case, for example, even if,
clearly, not all operators are going to be used in all modules.
What do you think?
VZ
I have to admit that even after years of working with SWIG I still often
make mistakes when writing %rename or %ignore directives. Sometimes it's as
stupid as putting them after the declaration of the symbol being renamed,
and sometimes it's more subtle, see https://github.com/swig/swig/issues/757
but in any case it takes me longer than it should to find and fix the
problem and this is mostly due to the fact that it takes time to even
realize that the directive wasn't taken into account in the first place.
I really wish SWIG could help me here, so I wonder if it could be a good
idea to add a warning, which would be given at the end of processing, if a
rename/ignore has never been used? It seems to me that there is no real
reason to have such directives not matching anything, so I believe such
warning would be useful as it would point out unintentional behaviour.
And we would provide some "allow_unused" attribute which could be set to
indicate that some particular directive can really be unused, this would be
useful for at least the directives in the SWIG library files which define
%renames for all the operators in Python case, for example, even if,
clearly, not all operators are going to be used in all modules.
What do you think?
VZ