[Uml-devel] Some compiler warnings
P. Fleury
fleury at users.sourceforge.net
Tue Oct 22 17:20:02 UTC 2002
Sebastian Stein wrote:
>2 warnings have been fixed by me in CVS, but with the next 3 I would like to
>ask first what to do:
>
>
>g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/kde/include
>-I/usr/lib/qt-3.0.3/include
>-I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor
>-Wno-long-long -Wbad-function-cast -Wundef -Wall -pedantic -W
>-Wpointer-arith
>-Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
>-Wcast-align -Wconversion -fno-builtin -g -O2 -fno-exceptions -fno-check-new
>-c
>-o umllistview.o `test -f umllistview.cpp || echo './'`umllistview.cpp
>umllistview.cpp: In method `bool UMLListView::serialize(QDataStream *, bool,
>int)':
>umllistview.cpp:737: warning: `class UMLListViewItem * folder' might be used
>uninitialized in this function
>umllistview.cpp:739: warning: `class UMLListViewItem * prev' might be used
>uninitialized in this function
>umllistview.cpp:744: warning: `class UMLObject * o' might be used
>uninitialized
>in this function
>source='seqlinewidget.cpp' object='seqlinewidget.o' libtool=no \
>depfile='.deps/seqlinewidget.Po' tmpdepfile='.deps/seqlinewidget.TPo' \
>depmode=gcc /bin/sh ../admin/depcomp \
>
>
Do you get these warnings also when compiling without the -O2 flag ?
Sometimes, the order of instructions in an optimized object code makes
it so that there is no initialization to these variables.
In any case, one simple fix I've used in the past to remove the warnings
is to set then to NULL in their initializer. This will force the
compiler to do this value assignement, and it will no longer complain.
And we waste a few cycles on our pentiums 3.7GHz :-)
--Pascal
More information about the umbrello-devel
mailing list