Cleanup SWIG_VERSION definition

Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.

Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this

Closes #1050
This commit is contained in:
William S Fulton 2022-10-13 19:46:51 +01:00
commit 46f7501d94
31 changed files with 68 additions and 76 deletions

View file

@ -4,8 +4,6 @@
* C# typemaps
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
%include <csharphead.swg>
/* The ctype, imtype and cstype typemaps work together and so there should be one of each.

View file

@ -4,8 +4,6 @@
* Go configuration module.
* ------------------------------------------------------------ */
%include <typemaps/swigversion.swg>
%include <gostring.swg>
/* Code insertion directives */

View file

@ -4,8 +4,6 @@
* SWIG Configuration File for Guile.
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
/* Macro for inserting Scheme code into the stub */
#define %scheme %insert("scheme")
#define %goops %insert("goops")

View file

@ -4,8 +4,6 @@
* Java typemaps
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
%include <javahead.swg>
/* The jni, jtype and jstype typemaps work together and so there should be one of each.

View file

@ -5,8 +5,6 @@
* This file is parsed by SWIG before reading any other interface file.
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
/* -----------------------------------------------------------------------------
* includes
* ----------------------------------------------------------------------------- */

View file

@ -5,8 +5,6 @@
* This file is parsed by SWIG before reading any other interface file.
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
/* Include headers */
%runtime "swigrun.swg" // Common C API type-checking code
%runtime "swigerrors.swg" // SWIG errors

View file

@ -4,8 +4,6 @@
* SWIG Configuration File for Ocaml
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
/* Insert common stuff */
%insert(runtime) "swigrun.swg"

View file

@ -4,8 +4,6 @@
* PHP configuration file
* ----------------------------------------------------------------------------- */
%include <typemaps/swigversion.swg>
// Default to generating PHP type declarations (for PHP >= 8) except for
// cases which are liable to cause compatibility issues with existing
// bindings.

View file

@ -48,7 +48,6 @@ std_strings.swg Common macros to implemented the std::string/std::wstring typem
strings.swg Common macros and typemaps for string and wstring (char *, wchar_t *)
swigmacros.swg Basic macros
swigversion.swg Define SWIG_VERSION
fragments.swg Macros for fragment manipulations

View file

@ -109,8 +109,6 @@ nocppval
#endif
%enddef
%include <typemaps/swigversion.swg>
/* -----------------------------------------------------------------------------
* Casting operators
* ----------------------------------------------------------------------------- */

View file

@ -1,16 +0,0 @@
/* -----------------------------------------------------------------------------
* Define SWIG_VERSION
* ----------------------------------------------------------------------------- */
/* Define SWIG_VERSION in the interface and the wrapper code.
*
* Best practice is to use SWIG-time checks for SWIG_VERSION, but SWIG_VERSION
* was unintentionally defined like this for many years, and while it was never
* documented there are likely user interface files which rely on it.
*/
%define %define_swig_version_()%#define SWIG_VERSION_ SWIG_VERSION %enddef
%insert("header") {
%define_swig_version_()
%#define SWIG_VERSION SWIG_VERSION_
}
#undef %define_swig_version_