[Therion] Fw: Bug#565049: therion: ftbfs with gcc-4.5

Aaron Birenboim aaron at boim.com
Fri Jan 15 22:04:55 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wookey wrote:
> +++ Aaron Birenboim [2010-01-15 07:44 -0700]:
>> Wookey wrote:
>>> Guys - someone is testing if debian packages build with gcc 4.5, and
>>> therion doesn't. Anyone got any ideas how to fix this, or do we
>>> contend that it is actually a compiler bug?
>> I have many debian and ubuntu machines.
>> I could (most likely) get 4.5 on one of them.
> 
> That's easy: add experimental to your sources.list and aptitude update;
> aptitude install gcc-4.5
> (http://packages.debian.org/experimental/gcc-4.5)
> 
>> Could you give me a hint at how best to help?
> 
> Examinging the buildlog failure linked in the message may be
> sufficient to make the problem obvious to a C++-competent person.
> http://people.debian.org/~lucas/logs/2010/01/08b/therion_5.2.8-1_lsid64b.buildlog

c++ -c -Wall -DTHLINUX -O2 -o thexpmap.o thexpmap.cxx
In file included from thexpmap.cxx:75:0:
thsvg.h:26:79: error: cannot call constructor 'legenddata::legenddata'
directly
thsvg.h:26:79: note: for a function-style cast, remove the redundant
'::legenddata'
make[1]: *** [thexpmap.o] Error 1
make[1]: Leaving directory
`/build/user-therion_5.2.8-1-amd64-9Je2GG/therion-5.2.8/build-tree/therion'
make: *** [build-stamp] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2


This is an odd line of code, that I've never seen before.
I'm not up-to-date on the latest versions of therion, or the compiler,
but I have never seen such a declaration before:

void thsvg(char * fname, int, legenddata ldata = legenddata::legenddata());

AFAIK, you can only define defaults (in ANSI C++) to constant parameters.
Also, it should invoke the default constructor when creating a temporary
object, so the explicit call should not be necessary.
(And it seems incorrect to me, but it seems that several compilers took
it ok)

Hence, I would think that the call declaration:

void thsvg(char * fname, int, const legenddata ldata =
legenddata::legenddata());

might be more correct, although

void thsvg(char * fname, int, const legenddata ldata = legenddata());

might work.

To be safe, I might just switch over to overloading this function.
I'm pretty sure every compiler will like:
- -------------------------------------------------------
void thsvg(char * fname, int, legenddata ldata);
inline void thsvg(char * fname, int i)
{
  legenddata ldata;
  thsvg(fname,i,ldata);
}
- -----------------------------------------------------  in thsvg.h

If you don't like the inline, you could just overload another function,
without the optional parameter,
and implement the 2 parameter version in thsvg.cxx.

I am also shocked to see the default parameter definition in the .cxx
implementation.
Again, I can see where it could work, but I am surprised.
The typical way to do this is to #include "thsvg.h"
in thsg.cxx, and NOT declare the default parameter in the implementation.
This way, you get the compiler to double-check that your declarations match.

Let me know if you can/wish to give these suggestions a try.
If that does not solve the problem, I can go back to
trying to create a full, latest version build environment.
But... that will take a while.
There are many dependencies to BUILD therion that I do not
have on my machines, by default.
Was there some sort of apt-get command that would install
all the build-dependencies for a source package?

            aaron

To summarize:

I recommend overloading that function with a 2 and 3 parameter version.
Just do an inline declaration for the 2 parameter version that supplies
the default parameter.
Remove references to the default parameter constructor in the 3
parameter declaration (.h),
and in the implementation (.cxx).
This might not be as "slick" as what you have now, but it
might be more universal.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktQ2HcACgkQY9pzGJrjUYC+pwCgttfkTr7vRbEccWeEUNXceclW
ES0An2buDaxRfKMknl1+bpabRFQVLvoF
=94TG
-----END PGP SIGNATURE-----



More information about the Therion mailing list