From: William S F. <ws...@fu...> - 2012-05-08 18:57:18
|
On 04/05/12 23:38, Ian Lance Taylor wrote: > William S Fulton<ws...@fu...> writes: > > > On 20/04/12 07:15, Miles Bader wrote: > >> Ian Lance Taylor<ia...@ai...> writes: > >>> I suppose I don't see it as a big problem if a distro builds a new > SWIG > >>> with a new gccgo and the new SWIG works with the new gccgo, even > if that > >>> means behaving differently than the earlier SWIG. > >> > >> Er, not everything is done in "completely distro upgrade" units. > >> > >> A system can have multiple compilers installed, and stuff installed by > >> the user. > >> > > > > Yes, the approach that is used with the other language modules is to > > generate code that will compile under all environments. The generated > > code instead needs to contain macros to deal with the different versions > > of gccgo. That way a 3rd party that uses SWIG to generate code can ship > > just one version of the generated code to their users and so the code > > will then 'just work' with whatever versions of tools they have to / > > want to use. > > This is hard to do in Go, as Go doesn't have any form of conditional > compilation in the source code. > > Since gccgo is not the primary Go compiler, and since gccgo 4.7.0 is a > more stable release than 4.6.x, I have removed support for gccgo 4.6.x > from SWIG. People who want to use the older version of gccgo will have > to use an older version of SWIG. > > Again, gccgo is not the primary Go compiler, and most people will use > SWIG with the gc compiler, for which older versions will continue to > work. Okay, that is fair enough for now. If you have any influence over gccgo, requesting a macro indicating the Go version for conditional compilation of the C++ side shouldn't be a big ask. Not sure what to suggest on the Go language side of the wrappers, but being able to detect the version of the target language is the norm in the other languages and certainly eases code generator tools like SWIG. Even if it is just to stop the C++ wrapper compilation in its tracks saying "version x unsupported, only version y is supported", then getting the equivalent information on the Go side of the wrappers need not be solved. William |