Export to GitHub

chipmunk-physics - issue #45

Lots of warnings about pragma mark


Posted on Nov 27, 2011 by Swift Ox

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.

Comment #1

Posted on Nov 27, 2011 by Swift Ox

Aww sorry, I forgot to specify my environment:

I'm using Ekopath compiler on Linux.

Comment #2

Posted on Nov 27, 2011 by Happy Giraffe

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.

Comment #3

Posted on Dec 2, 2011 by Happy Giraffe

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

Comment #4

Posted on Dec 4, 2011 by Swift Ox

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.

Status: WontFix

Labels:
Type-Defect Priority-Medium