Box2D Forums

It is currently Sat May 18, 2013 8:20 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Jul 31, 2008 10:47 am 
Offline

Joined: Sun Jul 27, 2008 3:23 pm
Posts: 3
Usually I compile all my projects with the -Wall option of g++, as the warnings are often quite use full. Unfortunately Box2D itself produces so many warnings, that compiling with this option it is almost useless for debugging my own code.

Most of the warnings are of the form
Code:
./src/Box2D/Include/../Source/Dynamics/b2WorldCallbacks.h: In member function ‘virtual void b2ContactListener::Add(const b2ContactPoint*)’:
./src/Box2D/Include/../Source/Dynamics/b2WorldCallbacks.h:95: warning: statement has no effect

so it should be easy to fix them.

Would help a lot when working with Box2D!


Top
 Profile  
 
PostPosted: Thu Jul 31, 2008 10:53 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2931
That is due to

Code:
B2_NOT_USED(point);


I put that code in there so that VC++ wouldn't produce a warning about an unused variable. How should this be done in g++?


Top
 Profile  
 
PostPosted: Fri Aug 01, 2008 9:01 am 
Offline

Joined: Thu Jul 17, 2008 9:34 pm
Posts: 35
in gcc/g++ the format is

int x __attribute__ ((unused))

#define B2_NOT_USED(x) x __attribute__ ((unused))

http://gcc.gnu.org/onlinedocs/gcc/Varia ... butes.html
This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable.


Top
 Profile  
 
PostPosted: Tue Aug 05, 2008 2:57 am 
Offline

Joined: Tue Aug 05, 2008 2:52 am
Posts: 1
Both VC++ (I've only checked with 2003) and g++ also support just not naming the variable that is going unused to suppress the warning.
Code:
int foo(int)
{
  return 3;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group