Page 1 of 1

Enforcing stricter compile flags?

Posted: Fri Jun 17, 2011 10:43
by wondersye
Hi,

Apparently, when compiling code making use of CEGUI 0.7.5 on Ubuntu 10.04.2 with g++ (gcc i486-linux-gnu, version 4.4.3) and following compilation flags (which are a bit stricter than CEGUI's native ones):

Code: Select all

-Wno-unknown-pragmas -D_REENTRANT -g -ggdb -O0 -fno-inline -Wall -Werror -Woverloaded-virtual -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wsign-compare -Wmissing-format-attribute -Wno-unused-parameter -Wno-unknown-pragmas -Wno-long-long -pedantic-errors -Wredundant-decls -Wfloat-equal -ansi


following warnings/errors are detected:


Code: Select all

In file included from CEGUI-0.7.5/include/CEGUI/CEGUIAffector.h:33,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:34,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIString.h: In member function 'size_t CEGUI::String::encoded_size(const CEGUI::utf8*, size_t) const':
CEGUI-0.7.5/include/CEGUI/CEGUIString.h:4957: error: declaration of 'size' shadows a member of 'this'
In file included from CEGUI-0.7.5/include/CEGUI/CEGUIRect.h:34,
             from CEGUI-0.7.5/include/CEGUI/CEGUIBasicRenderedStri
ngParser.h:33,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:39,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h: In member function 'bool CEGUI::Vector2::operator==(const CEGUI::Vector2&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h:106: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h:106: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h: In member function 'bool CEGUI::Vector3::operator==(const CEGUI::Vector3&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h:139: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h:139: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIVector.h:139: error: comparing floating point with == or != is unsafe
In file included from CEGUI-0.7.5/include/CEGUI/CEGUIBasicRenderedStringParser.h:33,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:39,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIRect.h: In member function 'bool CEGUI:
:Rect::operator==(const CEGUI::Rect&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIRect.h:197: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIRect.h:197: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIRect.h:197: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIRect.h:197: error: comparing floating point with == or != is unsafe
In file included from CEGUI-0.7.5/include/CEGUI/CEGUIColourRect.h:35,
             from CEGUI-0.7.5/include/CEGUI/CEGUIBasicRenderedStringParser.h:34,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:39,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIcolour.h: In member function 'bool CEGUI::colour::operator==(const CEGUI::colour&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIcolour.h:247: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIcolour.h:248: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIcolour.h:249: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIcolour.h:250: error: comparing floating point with == or != is unsafe
In file included from CEGUI-0.7.5/include/CEGUI/CEGUICoordConverter.h:31,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:44,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h: In member function 'float CEGUI::UDim::asRelative(float) const':
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:61: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h: In member function 'CEGUI::UDim CEGUI::UDim::operator/(const CEGUI::UDim&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:80: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:81: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h: In member function 'const CEGUI::UDim& CEGUI::UDim::operator/=(const CEGUI::UDim&)':
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:106: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:107: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h: In member function 'bool CEGUI:
:UDim::operator==(const CEGUI::UDim&) const':
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:113: error: comparing floating point with == or != is unsafe
CEGUI-0.7.5/include/CEGUI/CEGUIUDim.h:113: error: comparing floating point with == or != is unsafe
In file included from CEGUI-0.7.5/include/CEGUI/CEGUINamedXMLResourceManager.h:35,
             from CEGUI-0.7.5/include/CEGUI/CEGUIFontManager.h:32,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:52,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIInputEvent.h: In constructor 'CEGUI::UpdateEventArgs::UpdateEventArgs(CEGUI::Window*, float)':
CEGUI-0.7.5/include/CEGUI/CEGUIInputEvent.h:260: error: declaration of 'window' shadows a member of 'this'
In file included from CEGUI-0.7.5/include/CEGUI/CEGUI.h:72,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIRenderedStringWordWrapper.h: At global scope:
CEGUI-0.7.5/include/CEGUI/CEGUIRenderedStringWordWrapper.h:72: error: redundant redeclaration of 'void CEGUI::RenderedStringWordWrapper<T>::format(const CEGUI::Size&) [with T = CEGUI::JustifiedRenderedString]' in same scope
CEGUI-0.7.5/include/CEGUI/CEGUIRenderedStringWordWrapper.h:54: error: previous declaration of 'void CEGUI::RenderedStringWordWrapper<T>::format(const CEGUI::Size&) [with T = CEGUI::JustifiedRenderedString]'
In file included from CEGUI-0.7.5/include/CEGUI/falagard/CEGUIFalPropertyDefinition.h:31,
             from CEGUI-0.7.5/include/CEGUI/falagard/CEGUIFalWidgetLookFeel.h:35,
             from CEGUI-0.7.5/include/CEGUI/falagard/CEGUIFalWidgetLookManager.h:34,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:110,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/CEGUIProperty.h:183: error: 'virtual void CEGUI::Property::writeXMLToStream(const CEGUI::PropertyReceiver*, CEGUI::XMLSerializer&) const' was hidden
CEGUI-0.7.5/include/CEGUI/falagard/CEGUIFalPropertyDefinitionBase.h:81
: error:   by 'virtual void CEGUI::PropertyDefinitionBase::writeXMLToStream(CEGUI::XMLSerializer&) const'
In file included from CEGUI-0.7.5/include/CEGUI/elements/CEGUITree.h:34,
             from CEGUI-0.7.5/include/CEGUI/elements/CEGUIAll.h:66,
             from CEGUI-0.7.5/include/CEGUI/CEGUI.h:113,
             from OSDLBasic.cc:69:
CEGUI-0.7.5/include/CEGUI/elements/CEGUITreeItem.h: In member function 'void CEGUI::TreeItem::setIcon(const CEGUI::Image&)':
CEGUI-0.7.5/include/CEGUI/elements/CEGUITreeItem.h:560: error: cast from type 'const CEGUI::Image*' to type 'CEGUI::Image*' casts away constness


I was wondering if it was possible that CEGUI enforces stricter flags (at least in installed headers), so that user projects do not have to loosen their own flags? I believe anyway it would lead to still better CEGUI's code?

Thanks in advance for any answer,

Olivier Boudeville.

Re: Enforcing stricter compile flags?

Posted: Fri Jun 17, 2011 10:49
by Kulik
This was actually my plan that has been postponed multiple times by now :-)

I created a ticket so this doesn't get lost.

http://www.cegui.org.uk/mantis/view.php?id=463