svn commit: samba r17645 - in branches/SAMBA_4_0/source/lib/talloc: .

tridge at samba.org tridge at samba.org
Mon Aug 21 05:27:17 GMT 2006


Metze,

 > thanks! Can you merge that to talloc_reference() and all other places
 > that uses that trick too.

It's not needed for talloc_reference(). It's basically a bug (or
mis-feature perhaps) in the gcc code that decides if a warning should
be generated for constructing a value that is not used. Normally this
warning is only emitted if you enable a special attribute. With the
macro we used to make talloc_steal() type safe, it was being emitted
every time.

It doesn't matter for talloc_reference(), as we actually do want to
always check the return value for that function, as it can fail due to
system resources (ie. it allocates memory). talloc_steal() can only
fail due to programmer error, so not checking its return value is
normal, just like functions like memmove(). However, unlike memmove(),
gcc was generating a warning when you didn't check the return value of
talloc_steal().

A gcc developer offered to work up a patch to gcc to avoid the
problem, but its easier to just avoid it with that ugly workaround, as
it means we don't have to upgrade gcc everywhere.

Cheers, Tridge


More information about the samba-cvs mailing list