Re: uninitialized member warnings ?

2012-09-27 Thread Terrence Enger





--
View this message in context: 
http://nabble.documentfoundation.org/REVIEW-3-6-trivial-cups-thread-init-issue-tp4008339p4009665.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: uninitialized member warnings ?

2012-09-27 Thread Michael Meeks

On Wed, 2012-09-26 at 15:29 +0200, Lubos Lunak wrote:
>  I don't think it can go anywhere practical:

:-) while it's certainly possibly to find cases where it is hard to
detect and warn about these problems, I imagine that catching many of
the banal cases and warning about those would be reasonably do-able -
while punting on the false positives.

> class A
> {
> bool foo;
> void init();
> public:
> A() { init(); }
> };
> 
>  How should the compiler know?

In this case; it should be clever ;-) we could defer the checking until
we compiled the init function: but of course, this soon gets pretty
intense cost-wise, and (absent LTO-scale visibility of all the code)
can't be perfect.

Warnings for constructors that don't call member functions, don't
initialise POD types, and/or don't pass references to them elsewhere
would surely be a useful if not complete win.

ATB,

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: uninitialized member warnings ?

2012-09-26 Thread Stephan Bergmann

On 09/26/2012 03:16 PM, Michael Meeks wrote:

There is no way for the compiler to decide this in general (unlike Java,
C++ does not have restricting rules to allow the compiler to do so).


no way ?


Note that I wrote "in general."

Stephan

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: uninitialized member warnings ?

2012-09-26 Thread Lubos Lunak
On Wednesday 26 of September 2012, Michael Meeks wrote:
> On Tue, 2012-09-25 at 14:26 +0200, Stephan Bergmann wrote:
> > >   Neato :-) the deeper question - as to why no warnings are popping out
> > > of the compiler for this when (surely) it's a trivial thing to check /
> > > warn for - is more concerning.
> >
> > Such a warning option has never been there AFAIK.
>
>   Oh - must be me mis-remembering it, or remembering valgrind output that
> catches that, silly me.
>
> > There is no way for the compiler to decide this in general (unlike Java,
> > C++ does not have restricting rules to allow the compiler to do so).
>
>   no way ? surely there is - add a warning for un-initialized POD members
> on the exit of the constructor. It seems that fools seldom differ, and
> there is such a patch here:
>
>   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2972
>
>   Doesn't seem to be going anywhere in the last month, but - you can but
> hope :-)

 I don't think it can go anywhere practical:

class A
{
bool foo;
void init();
public:
A() { init(); }
};

 How should the compiler know?

-- 
 Lubos Lunak
 l.lu...@suse.cz
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: uninitialized member warnings ?

2012-09-26 Thread Michael Meeks

On Tue, 2012-09-25 at 14:26 +0200, Stephan Bergmann wrote:
> > Neato :-) the deeper question - as to why no warnings are popping out
> > of the compiler for this when (surely) it's a trivial thing to check /
> > warn for - is more concerning.
>
> Such a warning option has never been there AFAIK.

Oh - must be me mis-remembering it, or remembering valgrind output that
catches that, silly me.

> There is no way for the compiler to decide this in general (unlike Java, 
> C++ does not have restricting rules to allow the compiler to do so).

no way ? surely there is - add a warning for un-initialized POD members
on the exit of the constructor. It seems that fools seldom differ, and
there is such a patch here:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2972

Doesn't seem to be going anywhere in the last month, but - you can but
hope :-)

ATB,

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: uninitialized member warnings ?

2012-09-25 Thread Stephan Bergmann

On 09/25/2012 11:26 AM, Michael Meeks wrote:

On Mon, 2012-09-24 at 20:17 +0100, Caolán McNamara wrote:

On Mon, 2012-09-24 at 11:55 -0400, Kohei Yoshida wrote:

On Thu, Sep 20, 2012 at 7:02 AM, Michael Meeks  wrote:

 I've noticed a number of these straying in. Did we disable a warning on
un-initialized members for some reason ? I could swear the compiler used
to complain helpfully about this.


Yeah, this was a recent cockup of mine when I did away with CUPSWrapper
and merged it into CUPSManager so master only


Neato :-) the deeper question - as to why no warnings are popping out
of the compiler for this when (surely) it's a trivial thing to check /
warn for - is more concerning.

Any gbuild experts have a view there ? :-)


There is no way for the compiler to decide this in general (unlike Java, 
C++ does not have restricting rules to allow the compiler to do so). 
Such a warning option has never been there AFAIK.


Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


uninitialized member warnings ?

2012-09-25 Thread Michael Meeks

On Mon, 2012-09-24 at 20:17 +0100, Caolán McNamara wrote:
> On Mon, 2012-09-24 at 11:55 -0400, Kohei Yoshida wrote:
> > On Thu, Sep 20, 2012 at 7:02 AM, Michael Meeks  
> > wrote:
> > > I've noticed a number of these straying in. Did we disable a 
> > > warning on
> > > un-initialized members for some reason ? I could swear the compiler used
> > > to complain helpfully about this.
>
> Yeah, this was a recent cockup of mine when I did away with CUPSWrapper
> and merged it into CUPSManager so master only

Neato :-) the deeper question - as to why no warnings are popping out
of the compiler for this when (surely) it's a trivial thing to check /
warn for - is more concerning.

Any gbuild experts have a view there ? :-)

Thanks,

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice