Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : GCC compiler warnings
New Topic New Poll Post Reply
Poster Message
ross
Level: Delver
Rank Points: 30
Registered: 05-17-2003
IP: Logged
icon GCC compiler warnings (0)  
As requested here are some warnings. It seems the Db*.cpp files are currently the weirdest :) I've been guessing the type to cast to (explained in the following list) so please let me know if I am way off mark ( and I did guess:) )

The following are all from DRODLib.

------------------
DbDemos.cpp: In member function `void CDbDemos::LoadMembership_ByShow()':
DbDemos.cpp:497: warning: choosing `CAttachableWrapper<T>::operator T&() [with
T = UINT]' over `CAttachableWrapper<T>::operator T() const [with T = UINT]'
DbDemos.cpp:497: warning: for conversion from `CAttachableWrapper<UINT>' to `
unsigned int'
DbDemos.cpp:497: warning: because conversion sequence for the argument is
better
DbDemos.cpp: In function `bool GetDemoStatBool(const CIDList&, long unsigned
int)':
DbDemos.cpp:1352: warning: choosing `CAttachableWrapper<T>::operator T&() [with
T = bool]' over `CAttachableWrapper<T>::operator T() const [with T = bool]'
DbDemos.cpp:1352: warning: for conversion from `CAttachableWrapper<bool>' to
`bool'
DbDemos.cpp:1352: warning: because conversion sequence for the argument is
better
DbDemos.cpp: In function `UINT GetDemoStatUint(const CIDList&, long unsigned
int)':
DbDemos.cpp:1364: warning: choosing `CAttachableWrapper<T>::operator T&() [with
T = UINT]' over `CAttachableWrapper<T>::operator T() const [with T = UINT]'
DbDemos.cpp:1364: warning: for conversion from `CAttachableWrapper<UINT>' to
`unsigned int'
DbDemos.cpp:1364: warning: because conversion sequence for the argument is
better
------------------
DbPackedVars.cpp: In member function `void CDbPackedVars::Clear()':
DbPackedVars.cpp:85: warning: deleting `void*' is undefined
DbPackedVars.cpp: In member function `void* CDbPackedVars::SetVar(const char*,
const void*, long unsigned int)':
DbPackedVars.cpp:255: warning: deleting `void*' is undefined
g++ -c -g -D_DEBUG -I/Users/ross/Devel/include/ -I/Users/ross/Devel/include/SDL -I. -c DbPlayers.cpp -o DbPlayers.o
DbPlayers.cpp:36:2: #error The byte order of several data-types may differ.
DbPlayers.cpp: In member function `std::string CDbPlayers::ExportXML(long
unsigned int, CDbRefs&, bool)':
DbPlayers.cpp:193: warning: name lookup of `dwIndex' changed for new ISO `for'
scoping
DbPlayers.cpp:183: warning: using obsolete binding at `dwIndex'
DbPlayers.cpp: In member function `bool CDbPlayer::Load(long unsigned int)':
DbPlayers.cpp:393: no match for `CDbPackedVars& = c4_BytesRef' operator
DbPackedVars.h:77: candidates are: const BYTE* CDbPackedVars::operator=(const
BYTE*)
DbPackedVars.h:79: c4_BytesRef&
CDbPackedVars::operator=(c4_BytesRef&)
DbPackedVars.h:70: CDbPackedVars&
CDbPackedVars::operator=(const CDbPackedVars&)
------------------
DbPlayers (35) Non window/Intel platforms must change this. This means me.
------------------
DbPlayers.cpp: In member function `std::string CDbPlayers::ExportXML(long
unsigned int, CDbRefs&, bool)':
DbPlayers.cpp:193: warning: name lookup of `dwIndex' changed for new ISO `for'
scoping
DbPlayers.cpp:183: warning: using obsolete binding at `dwIndex'
DbPlayers.cpp: In member function `bool CDbPlayer::Load(long unsigned int)':
DbPlayers.cpp:393: no match for `CDbPackedVars& = c4_BytesRef' operator
DbPackedVars.h:77: candidates are: const BYTE* CDbPackedVars::operator=(const
BYTE*)
DbPackedVars.h:79: c4_BytesRef&
CDbPackedVars::operator=(c4_BytesRef&)
DbPackedVars.h:70: CDbPackedVars&
CDbPackedVars::operator=(const CDbPackedVars&)
Guessed at (c4_BytesRef&)
______________________
DbRooms.cpp: In member function `void CDbRoom::SetExit(unsigned int, unsigned
int, long unsigned int)':
DbRooms.cpp:1565: warning: name lookup of `i' changed for new ISO `for' scoping
DbRooms.cpp:1539: warning: using obsolete binding at `i'
DbRooms.cpp: In member function `bool CDbRoom::LoadMonsters(c4_View&)':
DbRooms.cpp:2053: no match for `CDbPackedVars& = c4_BytesRef' operator
DbPackedVars.h:77: candidates are: const BYTE* CDbPackedVars::operator=(const
BYTE*)
DbPackedVars.h:79: c4_BytesRef&
CDbPackedVars::operator=(c4_BytesRef&)
DbPackedVars.h:70: CDbPackedVars&
CDbPackedVars::operator=(const CDbPackedVars&)
DbRooms.cpp: In member function `void CDbRoom::DeleteOrbAtSquare(unsigned int,
unsigned int)':
DbRooms.cpp:2257: warning: name lookup of `wOrbI' changed for new ISO `for'
scoping
DbRooms.cpp:2246: warning: using obsolete binding at `wOrbI'
DbRooms.cpp: In member function `void
CDbRoom::DeleteScrollTextAtSquare(unsigned int, unsigned int)':
DbRooms.cpp:2282: warning: name lookup of `wScrollI' changed for new ISO `for'
scoping
DbRooms.cpp:2270: warning: using obsolete binding at `wScrollI'
DbRooms.cpp: In member function `void CDbRoom::SetScrollTextAtSquare(unsigned
int, unsigned int, WCHAR*)':
DbRooms.cpp:2376: warning: name lookup of `wScrollI' changed for new ISO `for'
scoping
DbRooms.cpp:2362: warning: using obsolete binding at `wScrollI'
DbRooms.cpp: In member function `bool CDbRoom::IsTarVulnerableToStab(unsigned
int, unsigned int) const':
DbRooms.cpp:2634: warning: name lookup of `i' changed for new ISO `for' scoping
DbRooms.cpp:2611: warning: using obsolete binding at `i'
DbRooms.cpp: In member function `void CDbRoom::Plot(unsigned int, unsigned int,
unsigned int, CMonster*)':
DbRooms.cpp:3172: warning: name lookup of `eMovement' changed for new ISO `for'
scoping
DbRooms.cpp:3139: warning: using obsolete binding at `eMovement'
___________________
DbSavedGames.cpp: In member function `bool CDbSavedGame::Load(long unsigned
int)':
DbSavedGames.cpp:103: no match for `CDbCommands& = c4_BytesRef' operator
DbCommands.h:57: candidates are: const BYTE* CDbCommands::operator=(const
BYTE*)
DbCommands.h:59: c4_BytesRef&
CDbCommands::operator=(c4_BytesRef&)
DbCommands.h:87: CDbCommands& CDbCommands::operator=(const
CDbCommands&)
___________________
DbXML.cpp: In static member function `static MESSAGE_ID CDbXML::ImportXML(const
WCHAR*)':
DbXML.cpp:543: `UCHAR' undeclared (first use this function)
DbXML.cpp:544: `ULONG' undeclared (first use this function)
DbXML.cpp:546: `B' undeclared (first use this function)

Following needed in Types.h
typedef unsigned long ULONG;
typedef unsigned char UCHAR;
______________________
Goblin.cpp: In member function `void CGoblin::GetNormalMovement(int&, int&,
int&, int&) const':
Goblin.cpp:127: call of overloaded `abs(unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
Goblin.cpp:128: call of overloaded `abs(unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
______________________

Monster.cpp: In member function `bool CMonster::IsSwordsmanWithin(unsigned int)
const':
Monster.cpp:207: call of overloaded `abs(unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int

Several times. Note that nDist in GameConstants.h also uses abs() and needs the cast.

--------------------
Serpent.cpp: In member function `virtual void
CSerpent::GetBrainDirectedMovement(int&, int&, int&, int&) const':
Serpent.cpp:233: call of overloaded `abs(long unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
Serpent.cpp:233: call of overloaded `abs(long unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
--------------------

IniFile.cpp: In member function `bool CIniFile::Load(const WCHAR*)':
IniFile.cpp:198: `isspace' undeclared (first use this function)
IniFile.cpp:198: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [IniFile.o] Error 1

Following should fix
#ifndef __Win32
#include <ctype.h>
#endif
--------------------

[Edited by ross on 05-19-2003 at 10:14 PM]
05-19-2003 at 11:06 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
ross
Level: Delver
Rank Points: 30
Registered: 05-17-2003
IP: Logged
icon Re: GCC compiler warnings (0)  
These warnings are all from the DROD directory. I'll just keep editing and adding to this post for now.
I could send patches I guess (diff -u) but I'm worried any changes I make here might bork the windows version.

Bolt.cpp: In function `void DrawBolt(int, int, int, int, SDL_Surface*,
SDL_Surface*)':
Bolt.cpp:159: warning: assignment to `DWORD' from `double'
Bolt.cpp:159: warning: argument to `long unsigned int' from `double'
----------------------------
EditRoomScreen.cpp: In constructor `CEditRoomScreen::CEditRoomScreen()':
EditRoomScreen.cpp:205: warning: initialization of negative value `-1' to `UINT
'
EditRoomScreen.cpp:205: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp:205: warning: initialization of negative value `-1' to `UINT
'
EditRoomScreen.cpp:205: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp:205: warning: initialization of negative value `-1' to `UINT
'
EditRoomScreen.cpp:205: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp:205: warning: initialization of negative value `-1' to `UINT
'
EditRoomScreen.cpp:205: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp: In member function `virtual void
CEditRoomScreen::-OnClick(long unsigned int)':
EditRoomScreen.cpp:884: warning: assignment of negative value `-1' to `UINT'
EditRoomScreen.cpp:884: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp: In member function `bool
CEditRoomScreen::RemoveObjectAt(unsigned int, unsigned int, bool&, bool&,
bool&)':
EditRoomScreen.cpp:2197: warning: ISO C++ forbids declaration of `wOTileNo'
with no type
EditRoomScreen.cpp:2198: warning: ISO C++ forbids declaration of `wTTileNo'
with no type
EditRoomScreen.cpp:2228: warning: initialization of negative value `-1' to `
UINT'
EditRoomScreen.cpp:2228: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp:2228: warning: initialization of negative value `-1' to `
UINT'
EditRoomScreen.cpp:2228: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp: In member function `void
CEditRoomScreen::SetState(EditState)':
EditRoomScreen.cpp:2447: warning: assignment of negative value `-1' to `UINT'
EditRoomScreen.cpp:2447: warning: argument of negative value `-1' to `unsigned
int'
EditRoomScreen.cpp: In member function `void CEditRoomScreen::ShowErrors()':
EditRoomScreen.cpp:2564: warning: name lookup of `wIndex' changed for new ISO
`for' scoping
EditRoomScreen.cpp:2561: warning: using obsolete binding at `wIndex
-------------------------
EventHandlerWidget.cpp: In member function `void
CEventHandlerWidget::Activate_HandleMouseDown(const SDL_MouseButtonEvent&)':
EventHandlerWidget.cpp:446: call of overloaded `abs(long unsigned int)' is
ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
EventHandlerWidget.cpp:447: call of overloaded `abs(long unsigned int)' is
ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
make: *** [EventHandlerWidget.o] Error 1
------------------------------
FileDialogWidget.cpp: In member function `void
CFileDialogWidget::SetDirectory(const WCHAR*)':
FileDialogWidget.cpp:457: `_wchdir' undeclared (first use this function)
FileDialogWidget.cpp:457: (Each undeclared identifier is reported only once for
each function it appears in.)

I've done a cheesy fix, probably needs to be in the Wchar.h non windows define section.
--------------------------------
GameScreen.cpp: In member function `SCREENTYPE
CGameScreen::ProcessCueEventsBeforeRoomDraw(CCueEvents&)':
GameScreen.cpp:1219: operands to ?: have different types
GameScreen.cpp:1266: warning: choosing `CAttachableWrapper<T>::operator T&()
[with T = UINT]' over `CAttachableWrapper<T>::operator T() const [with T =
UINT]'
GameScreen.cpp:1266: warning: for conversion from `CAttachableWrapper<UINT>'
to `unsigned int'
GameScreen.cpp:1266: warning: because conversion sequence for the argument is
better
GameScreen.cpp:1273: warning: choosing `CAttachableWrapper<T>::operator T&()
[with T = UINT]' over `CAttachableWrapper<T>::operator T() const [with T =
UINT]'
GameScreen.cpp:1273: warning: for conversion from `CAttachableWrapper<UINT>'
to `unsigned int'
GameScreen.cpp:1273: warning: because conversion sequence for the argument is
better
-----------------------------
MapWidget.cpp: In member function `void CMapWidget::InitMapColors()':
MapWidget.cpp:695: warning: ISO C++ forbids declaration of `bInitOnce' with no
type
-----------------------------

RestoreScreen.cpp: In member function `virtual void CRestoreScreen::Unload()':
RestoreScreen.cpp:232: warning: deleting `void* const' is undefined
RestoreScreen.cpp: In member function `void CRestoreScreen::SetCheckpoints()':
RestoreScreen.cpp:482: warning: deleting `void* const' is undefined
RestoreScreen.cpp: In member function `void
CRestoreScreen::ChooseCheckpoint(long unsigned int)':
RestoreScreen.cpp:545: warning: name lookup of `iSeek' changed for new ISO
`for' scoping
RestoreScreen.cpp:539: warning: using obsolete binding at `iSeek'
---------------------------

RoomWidget.cpp: In constructor `CRoomWidget::CRoomWidget(long unsigned int,
int, int, unsigned int, unsigned int, const CCurrentGame*)':
RoomWidget.cpp:116: warning: initialization of negative value `-1' to `UINT'
RoomWidget.cpp:116: warning: argument of negative value `-1' to `unsigned int'
RoomWidget.cpp: In member function `void
CRoomWidget::AddOrbAgentsEffect(COrbData*)':
RoomWidget.cpp:298: warning: assignment of negative value `-1' to `UINT'
RoomWidget.cpp:298: warning: argument of negative value `-1' to `unsigned int'
RoomWidget.cpp: In member function `void
CRoomWidget::AddMonsterSegmentEffect(unsigned int)':
RoomWidget.cpp:350: warning: ISO C++ forbids declaration of `bHorizontal' with
no type
RoomWidget.cpp:351: call of overloaded `abs(unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
RoomWidget.cpp:351: call of overloaded `abs(unsigned int)' is ambiguous
/usr/include/stdlib.h:108: candidates are: int abs(int)
/usr/include/gcc/darwin/3.1/g++-v3/cstdlib:119: long int
std::abs(long int)
RoomWidget.cpp: In member function `void CRoomWidget::DrawMonsters(CMonster*,
bool)':
RoomWidget.cpp:1991: warning: argument of negative value `-1' to `unsigned int'
RoomWidget.cpp:1992: warning: argument of negative value `-1' to `unsigned int'
------------------------

[Edited by ross on 05-20-2003 at 06:36 PM]
05-20-2003 at 07:28 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
ross
Level: Delver
Rank Points: 30
Registered: 05-17-2003
IP: Logged
icon Re: GCC compiler warnings (0)  
In case there is a limit on post sizes ...

CScalerWidget::DrawAntiAliasedLines(int, long unsigned int)':
ScalerWidget.cpp:473: warning: assignment to `unsigned char' from `double'
ScalerWidget.cpp:473: warning: argument to `unsigned char' from `double'
ScalerWidget.cpp:478: warning: assignment to `unsigned char' from `double'
ScalerWidget.cpp:478: warning: argument to `unsigned char' from `double'
ScalerWidget.cpp:483: warning: assignment to `unsigned char' from `double'
ScalerWidget.cpp:483: warning: argument to `unsigned char' from `double'
ScalerWidget.cpp:495: warning: name lookup of `yDest' changed for new ISO `for'
scoping

No I don't understand the last one.
--------------------------------
Screen.cpp:53: parse error before numeric constant

This one if very strange, it looks fine to me .. but.
-----------------------------
SliderWidget.cpp: In member function `virtual void CSliderWidget::Paint(bool)':
SliderWidget.cpp:173: warning: assignment to `Sint16' from `double'
SliderWidget.cpp:173: warning: argument to `short int' from `double'
SliderWidget.cpp:189: warning: assignment to `Sint16' from `double'
SliderWidget.cpp:189: warning: argument to `short int' from `double'
SliderWidget.cpp: In member function `void CSliderWidget::SetToX(int)':
SliderWidget.cpp:237: warning: initialization to `const BYTE' from `double'
SliderWidget.cpp:237: warning: argument to `unsigned char' from `double'
----------------------
SwordsmanSwirlEffect.cpp: In member function `virtual bool
CSwordsmanSwirlEffect::Draw()':
SwordsmanSwirlEffect.cpp:102: warning: initialization to `const UINT' from `
double'
SwordsmanSwirlEffect.cpp:102: warning: argument to `unsigned int' from `double'
SwordsmanSwirlEffect.cpp:103: warning: initialization to `const UINT' from `
double'
SwordsmanSwirlEffect.cpp:103: warning: argument to `unsigned int' from `double'
---------------------------
TabbedMenuWidget.cpp -o TabbedMenuWidget.o
TabbedMenuWidget.cpp: In member function `void
CTabbedMenuWidget::SelectTab(unsigned int)':
TabbedMenuWidget.cpp:220: warning: name lookup of `iSeek' changed for new ISO
`for' scoping
TabbedMenuWidget.cpp:211: warning: using obsolete binding at `iSeek'
-----------------------------
TitleScreen.cpp: In member function `virtual void
CTitleScreen::-OnMouseMotion(long unsigned int, const
SDL_MouseMotionEvent&)':
TitleScreen.cpp:284: warning: initialization to `const int' from `double'
TitleScreen.cpp:284: warning: argument to `int' from `double'
TitleScreen.cpp: In member function `void CTitleScreen::PaintHeads()':
TitleScreen.cpp:486: warning: initialization to `const int' from `double'
TitleScreen.cpp:486: warning: argument to `int' from `double'
TitleScreen.cpp:487: warning: initialization to `const int' from `double'
TitleScreen.cpp:487: warning: argument to `int' from `double'
TitleScreen.cpp:489: warning: initialization to `const int' from `double'
TitleScreen.cpp:489: warning: argument to `int' from `double'
TitleScreen.cpp:490: warning: initialization to `const int' from `double'
TitleScreen.cpp:490: warning: argument to `int' from `double'
TitleScreen.cpp:492: warning: initialization to `const int' from `double'
TitleScreen.cpp:492: warning: argument to `int' from `double'
TitleScreen.cpp:493: warning: initialization to `const int' from `double'
TitleScreen.cpp:493: warning: argument to `int' from `double'
TitleScreen.cpp:507: warning: initialization to `const int' from `double'
TitleScreen.cpp:507: warning: argument to `int' from `double'
TitleScreen.cpp:508: warning: initialization to `const int' from `double'
TitleScreen.cpp:508: warning: argument to `int' from `double'
TitleScreen.cpp:509: warning: initialization to `const int' from `double'
TitleScreen.cpp:509: warning: argument to `int' from `double'
TitleScreen.cpp:510: warning: initialization to `const int' from `double'
TitleScreen.cpp:510: warning: argument to `int' from `double'
g++ -c -g -I/Users/ross/Devel/include/ -I/Users/ross/Devel/include

[Edited by ross on 05-20-2003 at 06:40 PM]
05-20-2003 at 07:38 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Schik
Level: Legendary Smitemaster
Avatar
Rank Points: 5381
Registered: 02-04-2003
IP: Logged
icon Re: Re: GCC compiler warnings (0)  
ross wrote:
ScalerWidget.cpp:495: warning: name lookup of `yDest' changed for new ISO `for'
scoping

No I don't understand the last one.
That just means that by the new rules, if you define a variable like this:
for (int x=0; x < 5; x++) {
}
that you shouldn't use it after the loop. Easily fixed by rewriting it as:
int x;
for (x=0; x < 5; x++) {
}


Most of the rest are casting issues, again easily fixed.

About screwing up the Windows version, you send your diff to me (or Erik or Mike, I'm sure) and one of us can apply the patch and re-fix anything that gets broken.


____________________________
The greatness of a nation and its moral progress can be judged by the way it treats its animals.
--Mahatma Gandhi
05-20-2003 at 07:47 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores Quote Reply
ross
Level: Delver
Rank Points: 30
Registered: 05-17-2003
IP: Logged
icon Re: GCC compiler warnings (0)  
I see. Made worse I guess because I never knew the *old* rule.. :)

Thanks for the clarification though.
05-21-2003 at 09:16 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : GCC compiler warnings
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.