public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Strange syntax error problem with mmorpg-framework
@ 2008-03-17  7:49 Donald Duck
  2008-03-17 12:03 ` John Love-Jensen
  0 siblings, 1 reply; 5+ messages in thread
From: Donald Duck @ 2008-03-17  7:49 UTC (permalink / raw)
  To: gcc-help


Hi there,

I want to compile a big project from sourceforge.net (a mmorpg server
framework). But since a change in a source-file, gcc doesn't compile it at
all. I already asked on the project dev's forum, but the sayed, that I have
to use gcc 4.x.y ... This is quite strange, because I'm already using gcc
4.1.1-15.

Okay, here are the details:

To get the system compiled, i have to do the following:

----quote-----
autoreconf --install --force
./configure --prefix=/opt/mangos/mangos_
--sysconfdir=/opt/mangos/mangos_/etc --enable-cli --enable-ra
--datadir=/opt/mangos/mangos_
make > make.log 2>&1
----/quote-----

I used this lines also with earlier revisions and they always worked fine.

autoreconf is working, configure also. But make exits with this lines:

----quote----
   defines private constructors and has no friends
if g++ -DHAVE_CONFIG_H -I. -I. -I../..  -I/usr/include/mysql 
-I../../src/shared -I. -I./../../dep/include -I./../framework -I./../shared
-I./../shared/vmap -I./../realmd   -DENABLE_RA -DENABLE_CLI -DDO_MYSQL -g
-O2 -MT Player.o -MD -MP -MF ".deps/Player.Tpo" -c -o Player.o Player.cpp; \
then mv -f ".deps/Player.Tpo" ".deps/Player.Po"; else rm -f
".deps/Player.Tpo"; exit 1; fi
In file included from ../../src/shared/Database/DBCStores.h:25,
                 from ../../src/shared/Database/DatabaseEnv.h:26,
                 from Player.cpp:21:
../../src/shared/Database/DBCStructure.h:409: warning: `struct SpellEntry'
only
   defines private constructors and has no friends
Player.cpp: In member function `bool Player::UpdateSkill(unsigned int)':
Player.cpp:4366: error: syntax error before `|' token
Player.cpp:4366: error: syntax error before `)' token
Player.cpp: In member function `bool Player::UpdateSkillPro(short unsigned
int,
   int)':
Player.cpp:4475: error: syntax error before `|' token
Player.cpp:4475: error: syntax error before `)' token
Player.cpp: In member function `void Player::ModifySkillBonus(unsigned int,
   int, bool)':
Player.cpp:4588: error: syntax error before `|' token
Player.cpp:4588: error: syntax error before `)' token
Player.cpp: In member function `void Player::UpdateMaxSkills()':
Player.cpp:4613: error: syntax error before `|' token
Player.cpp:4613: error: syntax error before `)' token
Player.cpp: In member function `void
Player::UpdateSkillsToMaxSkillsForLevel()
   ':
Player.cpp:4631: error: syntax error before `|' token
Player.cpp:4631: error: syntax error before `)' token
Player.cpp: In member function `void Player::SetSkill(unsigned int, short
   unsigned int, short unsigned int)':
Player.cpp:4652: error: syntax error before `|' token
Player.cpp:4652: error: syntax error before `)' token
Player.cpp: At global scope:
Player.cpp:4675: error: syntax error before `else'
Player.cpp:4678: error: syntax error before `;' token
Player.cpp:4678: error: syntax error before `++' token
Player.cpp:4692: error: `i' was not declared in this scope
Player.cpp:4692: error: `currVal' was not declared in this scope
Player.cpp:4692: error: syntax error before `|' token
Player.cpp:4692: error: ISO C++ forbids declaration of `SetUInt32Value' with
no
   type
Player.cpp:4692: error: initializer list being treated as compound
expression
Player.cpp:4692: error: syntax error before `<<' token
Player.cpp:4695: error: `i' was not declared in this scope
Player.cpp:4695: error: ISO C++ forbids declaration of `SetUInt32Value' with
no
   type
Player.cpp:4695: error: redefinition of `int SetUInt32Value'
Player.cpp:4692: error: `int SetUInt32Value' previously defined here
Player.cpp:4695: error: initializer list being treated as compound
expression
Player.cpp:4698: error: syntax error before `const'
Player.cpp:4699: error: syntax error before `!=' token
Player.cpp:4704: error: syntax error before `const'
Player.cpp:4705: error: syntax error before `!=' token
Player.cpp: In member function `uint16 Player::GetMaxSkillValue(unsigned
int)
   const':
Player.cpp:4753: error: syntax error before `>>' token
Player.cpp: In member function `uint16 Player::GetPureMaxSkillValue(unsigned
   int) const':
Player.cpp:4767: error: syntax error before `>>' token
Player.cpp: In member function `uint16 Player::GetBaseSkillValue(unsigned
int)
   const':
Player.cpp:4781: error: syntax error before `>>' token
make[3]: *** [Player.o] Error 1
make[3]: Leaving directory `/opt/mangos/mangos-src/src/game'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/mangos/mangos-src/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/mangos/mangos-src'
make: *** [all] Error 2
----/quote----

Okay, I looked at the source . I'm not very good at c/c++ programming, but I
cannot find a syntax error. Also many other people in the dev's forum don't
have this problem. So I compared the different sourcecode revisions. I found
out, that the problems comes with revision 5126. Please have a look at the
following diff:
http://www.mangosproject.org/trac/changeset?old_path=trunk%2Fsrc%2Fgame%2FPlayer.cpp&old=5122&new_path=trunk%2Fsrc%2Fgame%2FPlayer.cpp&new=5126
player.cpp source diff rev5120->rev5126 

rev5120 compiles fine, rev5126 which has those changes, exits with the above
mentioned lines. 

I used debian sarge with gcc 4.1.1-15
I used SuSE linux 9.3 prof with gcc 4.1.1

Both aren't able to compile rev5126 and newer. Revisions up to 5126 are
working ...So it has to do with the changes in player.cpp

I would be pleased if someone could tell me if this is a gcc problem or
whatever this problems causes.
If you need further information, please let me know ...

with kind regards,
Alex
-- 
View this message in context: http://www.nabble.com/Strange-syntax-error-problem-with-mmorpg-framework-tp16089740p16089740.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange syntax error problem with mmorpg-framework
  2008-03-17  7:49 Strange syntax error problem with mmorpg-framework Donald Duck
@ 2008-03-17 12:03 ` John Love-Jensen
  2008-03-17 15:32   ` Donald Duck
  0 siblings, 1 reply; 5+ messages in thread
From: John Love-Jensen @ 2008-03-17 12:03 UTC (permalink / raw)
  To: Donald Duck, GCC-help

Hi Alex,

My first guess is that there is a problem of some sort around line 4366 of
Player.cpp.

My second guess is that all errors after that point are "cascade errors",
and not necessarily interesting in-and-of themselves.  (That is to say, fix
the first error, and all the subsequent "errors" may go away.)

Without seeing the code around line 4366, its hard to say.

Can you reproduce the problem in a small, self-contained, compilable sample
code that reproduces the problem?

If so, please provide the small sample code to this forum for analysis and
comment.

Please don't direct us to the original sourceforge code.  (Well, you can if
you want, but it is likely that few people on this forum will have the time
or inclination to pull down the source code and build it.  And even if so,
it may be that whatever problem you are experiencing does not reproduce.)

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange syntax error problem with mmorpg-framework
  2008-03-17 12:03 ` John Love-Jensen
@ 2008-03-17 15:32   ` Donald Duck
  2008-03-17 15:49     ` John Love-Jensen
  0 siblings, 1 reply; 5+ messages in thread
From: Donald Duck @ 2008-03-17 15:32 UTC (permalink / raw)
  To: gcc-help




Eljay Love-Jensen wrote:
> 
> Hi Alex,
> 
> My first guess is that there is a problem of some sort around line 4366 of
> Player.cpp.
> 

Yes, it seems so ...


Eljay Love-Jensen wrote:
> 
> My second guess is that all errors after that point are "cascade errors",
> and not necessarily interesting in-and-of themselves.  (That is to say,
> fix
> the first error, and all the subsequent "errors" may go away.)
> 

Also this is possible...


Eljay Love-Jensen wrote:
> 
> Without seeing the code around line 4366, its hard to say.
> 

I know. For his reason I posted a link which shows the "diff" between the
revision which compiles fine, and the revision that shows the errors during
compile process.


Eljay Love-Jensen wrote:
> 
> Can you reproduce the problem in a small, self-contained, compilable
> sample
> code that reproduces the problem?
> 
> If so, please provide the small sample code to this forum for analysis and
> comment.
> 

Sorry, I'm not very familiar wit c/c++. I know Java... that's all ;-(
But I know, that before rev5126 gcc shows no errors. The errors appeared
with rev5126 and following.


Eljay Love-Jensen wrote:
> 
> Please don't direct us to the original sourceforge code.  (Well, you can
> if
> you want, but it is likely that few people on this forum will have the
> time
> or inclination to pull down the source code and build it.  And even if so,
> it may be that whatever problem you are experiencing does not reproduce.)
> 

I don't want you to download the source and try a build by yourselves. 

I would be pleased if you can have a look at the "diff" and say me: "Yes,
that's gcc related. You have to ....", or "Okay, the problems come from a
weak implementation that doesn't fit gcc 4.1.1" or something like that. 

Here's the link that shows the "diff" between the revision that gcc compiles
fine, and the revision that doesn't compile fine ...

http://www.mangosproject.org/trac/changeset?old_path=trunk%2Fsrc%2Fgame%2FPlayer.cpp&old=5122&new_path=trunk%2Fsrc%2Fgame%2FPlayer.cpp&new=5126
player.cpp source diff rev5120->rev5126 

with kind regards and thank's for you really fast reply,

Alex

-- 
View this message in context: http://www.nabble.com/Strange-syntax-error-problem-with-mmorpg-framework-tp16089740p16094085.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange syntax error problem with mmorpg-framework
  2008-03-17 15:32   ` Donald Duck
@ 2008-03-17 15:49     ` John Love-Jensen
  2008-03-17 16:05       ` Alexander Christian
  0 siblings, 1 reply; 5+ messages in thread
From: John Love-Jensen @ 2008-03-17 15:49 UTC (permalink / raw)
  To: Donald Duck, GCC-help

Hi Alex,

The problem is probably in the expansion of the macros.

From the macros visible in the trunk/src/game/Player.cpp [5122:5445] diff,
it is not apparent what the problem is, since not all macros involved are
available in that diff.

It appears that someone tried to make accessing the "value index" more
regular, by introducing a PLAYER_SKILL_VALUE_INDEX macro function.  Perhaps
a glitch was introduced as well.

In general, for C++, I strongly recommend avoiding macro functions and macro
constants.  Instead, use the C++ facilities of inline functions and const
identifiers.

There are a few exceptions to my C++ rule-of-thumb, such as assert macro
functions.  But the exceptions to the rule are very few.

My advice is probably too late for the developers to adopt.  Alas.

You may be able to identify the problem if you compile that .cpp file with
the g++ -E switch, and look at the post-preprocessed output.

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange syntax error problem with mmorpg-framework
  2008-03-17 15:49     ` John Love-Jensen
@ 2008-03-17 16:05       ` Alexander Christian
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Christian @ 2008-03-17 16:05 UTC (permalink / raw)
  To: John Love-Jensen; +Cc: GCC-help

John Love-Jensen wrote:
> Hi Alex,
>
> The problem is probably in the expansion of the macros.
>
> From the macros visible in the trunk/src/game/Player.cpp [5122:5445] diff,
> it is not apparent what the problem is, since not all macros involved are
> available in that diff.
>   
The player.cpp source is directly available via 
http://www.mangosproject.org/trac/browser/trunk/src/game/Player.cpp?rev=5126&format=raw 
,  if you find time to have a look at it ...
> It appears that someone tried to make accessing the "value index" more
> regular, by introducing a PLAYER_SKILL_VALUE_INDEX macro function.  Perhaps
> a glitch was introduced as well.
>   

I opened player.cpp and search for "PLAYER_SKILL_VALUE_INDEX". I found 
the following at the beginning (nearly) of the file:

----code----
#define PLAYER_SKILL_VALUE_INDEX(x) (PLAYER_SKILL_INDEX(x)+1)
----/code----

Looks like the macro you mentioned?!

The "funny" thing is: This error's doesn't appear on all user's 
machines. There are many users out there who don't have this problems. 
So the errors aren't a real blocker. And that's why I'm so confused. The 
devs say, that gcc 4.x.y should work fine and don't have this problems. 
Is it possible that a library that gcc uses is not up2date for using 
those macros?
> In general, for C++, I strongly recommend avoiding macro functions and macro
> constants.  Instead, use the C++ facilities of inline functions and const
> identifiers.
>
> There are a few exceptions to my C++ rule-of-thumb, such as assert macro
> functions.  But the exceptions to the rule are very few.
>
> My advice is probably too late for the developers to adopt.  Alas.
>   
I will post this to the devs... Maybe it's not "too late" ;-)

> You may be able to identify the problem if you compile that .cpp file with
> the g++ -E switch, and look at the post-preprocessed output.
>
> Sincerely,
> --Eljay
>
>   

I will have to look at the created makefile to enable this switch ...

so far, thanks for your help.

br,
Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-17 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-17  7:49 Strange syntax error problem with mmorpg-framework Donald Duck
2008-03-17 12:03 ` John Love-Jensen
2008-03-17 15:32   ` Donald Duck
2008-03-17 15:49     ` John Love-Jensen
2008-03-17 16:05       ` Alexander Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).