Jiaoma / chipmunk-physics

Automatically exported from code.google.com/p/chipmunk-physics
MIT License
0 stars 0 forks source link

Lots of warnings about pragma mark #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. build the library in Debug

What is the expected output? What do you see instead?
A lot of warnings about unkown pragmas are shown during the build process. 
Something looking like this:
include/chipmunk/cpSpatialIndex.h:40: warning: ignoring #pragma mark Spatial
include/chipmunk/cpSpatialIndex.h:67: warning: ignoring #pragma mark Spatial
include/chipmunk/cpSpatialIndex.h:84: warning: ignoring #pragma mark AABB
include/chipmunk/cpSpatialIndex.h:104: warning: ignoring #pragma mark Single
include/chipmunk/cpSpatialIndex.h:115: warning: ignoring #pragma mark Spatial

This also happens when you just incude chipmunk.h into your project.

What version of the product are you using? On what operating system?
git revision 7290148c8266e447b6dfa19cc7ebf4ba59b8692c.

Please provide any additional information below.
For some reason (I didn't inspect the code) this only happens in debug builds. 
Releases are fine. This breaks my no-warnings policy and pollutes compiler's 
output.

Please, please, please: don't use those nasty pragmas in any code ever. 
Especially on multi-platform projects. If you do, someone else might think it's 
a good idea to add pragma sections, and someone else would have some other 
brilliant idea and so on.
Even on the same platform, you never know what editor people is using.
Note that #pragma is intended to give further directives to the compiler, and 
even like that it's nasty enough. Giving directives to the IDE is as much a 
good idea as using XML comments in your code.

Original issue reported on code.google.com by mich...@gmx.tm on 27 Nov 2011 at 2:18

GoogleCodeExporter commented 8 years ago
Aww sorry, I forgot to specify my environment:

I'm using Ekopath compiler on Linux.

Original comment by mich...@gmx.tm on 27 Nov 2011 at 2:20

GoogleCodeExporter commented 8 years ago
Well, they are very useful to me for navigation. You can always ignore them 
using -Wno-pragmas (or similar). The entire point of pragmas is to provide for 
optional behavior like this. Given that Chipmunk isn't written in vanilla ISO C 
you can't compile it in any compiler without flags and get no warnings or 
errors of some kind.

Original comment by slemb...@gmail.com on 27 Nov 2011 at 6:12

GoogleCodeExporter commented 8 years ago
You are in luck. I found that I can also use //MARK: comments to do the same 
thing without needing the pragmas. That should make both of us happy.

I made the change in the github repository. (Chipmunk moved some months ago) 
https://github.com/slembcke/Chipmunk-Physics

Original comment by slemb...@gmail.com on 2 Dec 2011 at 8:53

GoogleCodeExporter commented 8 years ago
Ah good to know and thanks for remembering about it. Though it is your code, so 
keeping it readable is for your own good. If you decide to change editor or 
someone else on another editor tries to read your code you will have useless 
pragmas scattered everywhere and maybe warnings. I know pragmas are compiler 
specific, that's  why I usually enclose them in ifdefs and try to keep them to 
a minimum. IMO, sticking to standardized things is always a winning bet.

Original comment by mich...@gmx.tm on 4 Dec 2011 at 11:47