Opened 19 years ago

Closed 19 years ago

Last modified 6 years ago

#2086 closed defect (fixed)

SAGA: Fails to compile with gcc4.0

Reported by: SF/mnbv Owned by: sev-
Priority: high Component: Engine: SAGA
Version: Keywords:
Cc: Game:

Description

After doing a cvs update today I tried to build a debian package by doing "make deb". This is the error I got :

g++ -Wp,-MMD,"saga/.deps/isomap.d",-MQ,"saga/isomap.o",-MP -Wall -g -ansi -W -Wno-unused-parameter -O -Wuninitialized -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -pedantic -Wpointer-arith -Wcast-qual -Wconversion -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wno-reorder -Wwrite-strings -fcheck-new -DHAVE_CONFIG_H -DUNIX -DDISABLE_KYRA -I. -I. -I/usr/include/SDL -D_REENTRANT -Itest/cxxtest -c saga/isomap.cpp -o saga/isomap.o saga/isomap.cpp: In member function 'void Saga::IsoMap::drawTile(Saga::SURFACE*, uint16, const Common::Point&, const Saga::Location*)': saga/isomap.cpp:873: error: cast from 'void*' to 'uint' loses precision saga/isomap.cpp:873: error: cast from 'byte*' to 'uint' loses precision saga/isomap.cpp:874: error: cast from 'void*' to 'uint' loses precision saga/isomap.cpp:874: error: cast from 'byte*' to 'uint' loses precision make[2]: *** [saga/isomap.o] Error 1 make[2]: Leaving directory `/home/grahame/scummvm' make[1]: *** [build] Error 2 make[1]: Leaving directory `/home/grahame/scummvm' make: *** [deb] Error 2

Using Debian unstable (amd64) with gcc4.0 (the new default compiler)

Ticket imported from: #1235211. Ticket imported from: bugs/2086.

Change History (11)

comment:1 by eriktorbjorn, 19 years ago

Since both lines are assert()s, the simplest workaround would be to simply remove them.

comment:2 by eriktorbjorn, 19 years ago

Owner: set to SF/h00ligan

comment:3 by SF/h00ligan, 19 years ago

can you try it: assert((byte*)ds->pixels <= (byte*)(drawPointer + count)); assert((byte*)((byte*)ds->pixels + (_vm->getDisplayWidth() * _vm->getDisplayHeight())) > (byte*)(drawPointer + count));

does it helps You?

comment:4 by SF/mnbv, 19 years ago

I tried changing the lines as you suggested but it still fails to build. The error recieved now is :

g++ -Wp,-MMD,"saga/.deps/isomap.d",-MQ,"saga/isomap.o",-MP -Wall -g -ansi -W -Wno-unused-parameter -O -Wuninitialized -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -pedantic -Wpointer-arith -Wcast-qual -Wconversion -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wno-reorder -Wwrite-strings -fcheck-new -DHAVE_CONFIG_H -DUNIX -DDISABLE_KYRA -I. -I. -I/usr/include/SDL -D_REENTRANT -Itest/cxxtest -c saga/isomap.cpp -o saga/isomap.o saga/isomap.cpp:380: error: 'int Saga::IsoMap::draw' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:380: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:380: error: 'ds' was not declared in this scope saga/isomap.cpp:380: error: expected ',' or ';' before '{' token saga/isomap.cpp:395: error: variable or field 'drawSprite' declared void saga/isomap.cpp:395: error: 'int Saga::IsoMap::drawSprite' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:395: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:395: error: 'ds' was not declared in this scope saga/isomap.cpp:395: error: expected primary-expression before '&' token saga/isomap.cpp:395: error: 'spriteList' was not declared in this scope saga/isomap.cpp:395: error: expected primary-expression before 'int' saga/isomap.cpp:395: error: expected primary-expression before 'const' saga/isomap.cpp:395: error: expected primary-expression before 'const' saga/isomap.cpp:395: error: expected primary-expression before 'int' saga/isomap.cpp:395: error: initializer expression list treated as compound expression saga/isomap.cpp:395: error: expected ',' or ';' before '{' token saga/isomap.cpp:432: error: variable or field 'drawTiles' declared void saga/isomap.cpp:432: error: 'int Saga::IsoMap::drawTiles' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:432: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:432: error: 'ds' was not declared in this scope saga/isomap.cpp:432: error: expected primary-expression before 'const' saga/isomap.cpp:432: error: initializer expression list treated as compound expression saga/isomap.cpp:432: error: expected ',' or ';' before '{' token saga/isomap.cpp:554: error: variable or field 'drawSpriteMetaTile' declared void saga/isomap.cpp:554: error: 'int Saga::IsoMap::drawSpriteMetaTile' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:554: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:554: error: 'ds' was not declared in this scope saga/isomap.cpp:554: error: expected primary-expression before 'metaTileIndex' saga/isomap.cpp:554: error: expected primary-expression before 'const' saga/isomap.cpp:554: error: expected primary-expression before '&' token saga/isomap.cpp:554: error: 'location' was not declared in this scope saga/isomap.cpp:554: error: expected primary-expression before 'absU' saga/isomap.cpp:554: error: expected primary-expression before 'absV' saga/isomap.cpp:554: error: initializer expression list treated as compound expression saga/isomap.cpp:554: error: expected ',' or ';' before '{' token saga/isomap.cpp:581: error: variable or field 'drawMetaTile' declared void saga/isomap.cpp:581: error: 'int Saga::IsoMap::drawMetaTile' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:581: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:581: error: 'ds' was not declared in this scope saga/isomap.cpp:581: error: expected primary-expression before 'metaTileIndex' saga/isomap.cpp:581: error: expected primary-expression before 'const' saga/isomap.cpp:581: error: expected primary-expression before 'absU' saga/isomap.cpp:581: error: expected primary-expression before 'absV' saga/isomap.cpp:581: error: initializer expression list treated as compound expression saga/isomap.cpp:581: error: expected ',' or ';' before '{' token saga/isomap.cpp:608: error: variable or field 'drawSpritePlatform' declared void saga/isomap.cpp:608: error: 'int Saga::IsoMap::drawSpritePlatform' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:608: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:608: error: 'ds' was not declared in this scope saga/isomap.cpp:608: error: expected primary-expression before 'platformIndex' saga/isomap.cpp:608: error: expected primary-expression before 'const' saga/isomap.cpp:608: error: expected primary-expression before 'const' saga/isomap.cpp:608: error: expected primary-expression before 'absU' saga/isomap.cpp:608: error: expected primary-expression before 'absV' saga/isomap.cpp:608: error: expected primary-expression before 'absH' saga/isomap.cpp:608: error: initializer expression list treated as compound expression saga/isomap.cpp:608: error: expected ',' or ';' before '{' token saga/isomap.cpp:663: error: variable or field 'drawPlatform' declared void saga/isomap.cpp:663: error: 'int Saga::IsoMap::drawPlatform' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:663: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:663: error: 'ds' was not declared in this scope saga/isomap.cpp:663: error: expected primary-expression before 'platformIndex' saga/isomap.cpp:663: error: expected primary-expression before 'const' saga/isomap.cpp:663: error: expected primary-expression before 'absU' saga/isomap.cpp:663: error: expected primary-expression before 'absV' saga/isomap.cpp:663: error: expected primary-expression before 'absH' saga/isomap.cpp:663: error: initializer expression list treated as compound expression saga/isomap.cpp:663: error: expected ',' or ';' before '{' token saga/isomap.cpp:719: error: variable or field 'drawTile' declared void saga/isomap.cpp:719: error: 'int Saga::IsoMap::drawTile' is not a static member of 'class Saga::IsoMap' saga/isomap.cpp:719: error: 'SURFACE' was not declared in this scope saga/isomap.cpp:719: error: 'ds' was not declared in this scope saga/isomap.cpp:719: error: expected primary-expression before 'tileIndex' saga/isomap.cpp:719: error: expected primary-expression before 'const' saga/isomap.cpp:719: error: expected primary-expression before 'const' saga/isomap.cpp:719: error: initializer expression list treated as compound expression saga/isomap.cpp:719: error: expected ',' or ';' before '{' token make[2]: *** [saga/isomap.o] Error 1 make[2]: Leaving directory `/home/grahame/scummvm' make[1]: *** [build] Error 2 make[1]: Leaving directory `/home/grahame/scummvm' make: *** [deb] Error 2

comment:5 by fingolfin, 19 years ago

Priority: normalhigh
Summary: cvs fails to compile with gcc4.0SAGA: Fails to compile with gcc4.0

comment:6 by SF/h00ligan, 19 years ago

hm - You log looks afwull. Your first log about assertion has error at line 873, but now You reproduce error at more earlier lines (380 etc). i'm sure that You mess some source files.

can you update saga from cvs - and try again (changing whose assertion line with (byte*) cast)

comment:7 by SF/mnbv, 19 years ago

ok, that did work when I tried it again. I think that a script I have that updates some projects I watch must have fired up during the compile, talk about bad timing :)

Right now I get an error further into the build. Output as follows :

g++ -Wp,-MMD,"saga/.deps/sprite.d",-MQ,"saga/sprite.o",-MP -Wall -g -ansi -W -Wno-unused-parameter -O -Wuninitialized -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -pedantic -Wpointer-arith -Wcast-qual -Wconversion -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wno-reorder -Wwrite-strings -fcheck-new -DHAVE_CONFIG_H -DUNIX -DDISABLE_KYRA -I. -I. -I/usr/include/SDL -D_REENTRANT -Itest/cxxtest -c saga/sprite.cpp -o saga/sprite.o saga/sprite.cpp: In member function 'void Saga::Sprite::drawClip(Saga::Surface*, const Common::Rect&, const Common::Point&, int, int, const byte*)': saga/sprite.cpp:206: error: cast from 'void*' to 'uint' loses precision saga/sprite.cpp:206: error: cast from 'byte*' to 'uint' loses precision saga/sprite.cpp:207: error: cast from 'void*' to 'uint' loses precision saga/sprite.cpp:207: error: cast from 'byte*' to 'uint' loses precision saga/sprite.cpp:208: error: cast from 'const byte*' to 'uint' loses precision saga/sprite.cpp:208: error: cast from 'const byte*' to 'uint' loses precision saga/sprite.cpp:209: error: cast from 'const byte*' to 'uint' loses precision saga/sprite.cpp:209: error: cast from 'const byte*' to 'uint' loses precision make[2]: *** [saga/sprite.o] Error 1 make[2]: Leaving directory `/home/grahame/scummvm' make[1]: *** [build] Error 2

comment:8 by SF/mnbv, 19 years ago

I tried changing the lines in the new error message in a similar way to the fix you suggested for the first error :

assert((byte*)ds->pixels <= (byte*)(bufRowPointer + j + spritePointer.x)); assert(((byte*)ds->pixels + (_vm->getDisplayWidth() * _vm->getDisplayHeight())) > (byte*)(bufRowPointer + j + spritePointer.x)); assert((byte*)spriteBuffer <= (byte*)(scrRowPointer +j)); assert(((byte*)spriteBuffer + (width * height)) > (byte*)(scrPointer + j));

Scummvm now builds all the way

Disclaimer: I'm not saying this is the *right* fix just that it compiles right through.

Thanks for taking the time to look at this bug

comment:9 by sev-, 19 years ago

Owner: changed from SF/h00ligan to sev-
Resolution: fixed
Status: newclosed

comment:10 by sev-, 19 years ago

Commited, but in later case I had to cast pointers to (const byte *) instead of (byte *)

comment:11 by digitall, 6 years ago

Component: Engine: SAGA
Note: See TracTickets for help on using tickets.