Description: Add header guards Author: Stephen Kitt This adds header guards in all headers without guards, primarily to simplify automated analysis of the headers as a whole. --- a/include/chipmunk/cpArbiter.h +++ b/include/chipmunk/cpArbiter.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_ARBITER_H +#define CP_ARBITER_H + /// @defgroup cpArbiter cpArbiter /// The cpArbiter struct tracks pairs of colliding shapes. /// They are also used in conjuction with collision handler callbacks @@ -143,3 +146,5 @@ CP_EXPORT void cpArbiterCallWildcardSeparateB(cpArbiter *arb, cpSpace *space); /// @} + +#endif --- a/include/chipmunk/cpBody.h +++ b/include/chipmunk/cpBody.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_BODY_H +#define CP_BODY_H + /// @defgroup cpBody cpBody /// Chipmunk's rigid body type. Rigid bodies hold the physical properties of an object like /// it's mass, and position and velocity of it's center of gravity. They don't have an shape on their own. @@ -187,3 +190,5 @@ CP_EXPORT void cpBodyEachArbiter(cpBody *body, cpBodyArbiterIteratorFunc func, void *data); ///@} + +#endif --- a/include/chipmunk/cpConstraint.h +++ b/include/chipmunk/cpConstraint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_CONSTRAINT_H +#define CP_CONSTRAINT_H + /// @defgroup cpConstraint cpConstraint /// @{ @@ -93,3 +96,5 @@ #include "cpSimpleMotor.h" ///@} + +#endif --- a/include/chipmunk/cpDampedRotarySpring.h +++ b/include/chipmunk/cpDampedRotarySpring.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_DAMPED_ROTARY_SPRING_H +#define CP_DAMPED_ROTARY_SPRING_H + /// @defgroup cpDampedRotarySpring cpDampedRotarySpring /// @{ @@ -56,3 +59,5 @@ CP_EXPORT void cpDampedRotarySpringSetSpringTorqueFunc(cpConstraint *constraint, cpDampedRotarySpringTorqueFunc springTorqueFunc); /// @} + +#endif --- a/include/chipmunk/cpDampedSpring.h +++ b/include/chipmunk/cpDampedSpring.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_DAMPED_SPRING_H +#define CP_DAMPED_SPRING_H + /// @defgroup cpDampedSpring cpDampedSpring /// @{ @@ -66,3 +69,5 @@ CP_EXPORT void cpDampedSpringSetSpringForceFunc(cpConstraint *constraint, cpDampedSpringForceFunc springForceFunc); /// @} + +#endif --- a/include/chipmunk/cpGearJoint.h +++ b/include/chipmunk/cpGearJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_GEAR_JOINT_H +#define CP_GEAR_JOINT_H + /// @defgroup cpGearJoint cpGearJoint /// @{ @@ -43,3 +46,5 @@ CP_EXPORT void cpGearJointSetRatio(cpConstraint *constraint, cpFloat ratio); /// @} + +#endif --- a/include/chipmunk/cpGrooveJoint.h +++ b/include/chipmunk/cpGrooveJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_GROOVE_JOINT_H +#define CP_GROOVE_JOINT_H + /// @defgroup cpGrooveJoint cpGrooveJoint /// @{ @@ -48,3 +51,5 @@ CP_EXPORT void cpGrooveJointSetAnchorB(cpConstraint *constraint, cpVect anchorB); /// @} + +#endif --- a/include/chipmunk/cpHastySpace.h +++ b/include/chipmunk/cpHastySpace.h @@ -1,6 +1,9 @@ // Copyright 2013 Howling Moon Software. All rights reserved. // See http://chipmunk2d.net/legal.php for more information. +#ifndef CP_HASTY_SPACE_H +#define CP_HASTY_SPACE_H + /// cpHastySpace is exclusive to Chipmunk Pro /// Currently it enables ARM NEON optimizations in the solver, but in the future will include other optimizations such as /// a multi-threaded solver and multi-threaded collision broadphases. @@ -25,3 +28,5 @@ /// When stepping a hasty space, you must use this function. CP_EXPORT void cpHastySpaceStep(cpSpace *space, cpFloat dt); + +#endif --- a/include/chipmunk/cpMarch.h +++ b/include/chipmunk/cpMarch.h @@ -1,6 +1,9 @@ // Copyright 2013 Howling Moon Software. All rights reserved. // See http://chipmunk2d.net/legal.php for more information. +#ifndef CP_MARCH_H +#define CP_MARCH_H + /// Function type used as a callback from the marching squares algorithm to sample an image function. /// It passes you the point to sample and your context pointer, and you return the density. typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data); @@ -26,3 +29,5 @@ cpMarchSegmentFunc segment, void *segment_data, cpMarchSampleFunc sample, void *sample_data ); + +#endif --- a/include/chipmunk/cpPinJoint.h +++ b/include/chipmunk/cpPinJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_PIN_JOINT_H +#define CP_PIN_JOINT_H + /// @defgroup cpPinJoint cpPinJoint /// @{ @@ -48,3 +51,5 @@ CP_EXPORT void cpPinJointSetDist(cpConstraint *constraint, cpFloat dist); ///@} + +#endif --- a/include/chipmunk/cpPivotJoint.h +++ b/include/chipmunk/cpPivotJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_PIVOT_JOINT_H +#define CP_PIVOT_JOINT_H + /// @defgroup cpPivotJoint cpPivotJoint /// @{ @@ -45,3 +48,5 @@ CP_EXPORT void cpPivotJointSetAnchorB(cpConstraint *constraint, cpVect anchorB); /// @} + +#endif --- a/include/chipmunk/cpPolyShape.h +++ b/include/chipmunk/cpPolyShape.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_POLY_SHAPE_H +#define CP_POLY_SHAPE_H + /// @defgroup cpPolyShape cpPolyShape /// @{ @@ -54,3 +57,5 @@ CP_EXPORT cpFloat cpPolyShapeGetRadius(const cpShape *shape); /// @} + +#endif --- a/include/chipmunk/cpPolyline.h +++ b/include/chipmunk/cpPolyline.h @@ -1,6 +1,9 @@ // Copyright 2013 Howling Moon Software. All rights reserved. // See http://chipmunk2d.net/legal.php for more information. +#ifndef CP_POLYLINES_H +#define CP_POLYLINES_H + // Polylines are just arrays of vertexes. // They are looped if the first vertex is equal to the last. // cpPolyline structs are intended to be passed by value and destroyed when you are done with them. @@ -68,3 +71,5 @@ CP_EXPORT cpPolylineSet *cpPolylineConvexDecomposition(cpPolyline *line, cpFloat tol); #define cpPolylineConvexDecomposition_BETA cpPolylineConvexDecomposition + +#endif --- a/include/chipmunk/cpRatchetJoint.h +++ b/include/chipmunk/cpRatchetJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_RATCHET_JOINT_H +#define CP_RATCHET_JOINT_H + /// @defgroup cpRatchetJoint cpRatchetJoint /// @{ @@ -48,3 +51,5 @@ CP_EXPORT void cpRatchetJointSetRatchet(cpConstraint *constraint, cpFloat ratchet); /// @} + +#endif --- a/include/chipmunk/cpRobust.h +++ b/include/chipmunk/cpRobust.h @@ -1,3 +1,6 @@ +#ifndef CP_ROBUST_H +#define CP_ROBUST_H + #include "chipmunk/cpVect.h" // This is a private header for functions (currently just one) that need strict floating point results. @@ -9,3 +12,5 @@ // Check if p is behind one of v0 or v1 on axis n. cpBool cpCheckAxis(cpVect v0, cpVect v1, cpVect p, cpVect n); + +#endif --- a/include/chipmunk/cpRotaryLimitJoint.h +++ b/include/chipmunk/cpRotaryLimitJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_ROTARY_LIMIT_JOINT_H +#define CP_ROTARY_LIMIT_JOINT_H + /// @defgroup cpRotaryLimitJoint cpRotaryLimitJoint /// @{ @@ -43,3 +46,5 @@ CP_EXPORT void cpRotaryLimitJointSetMax(cpConstraint *constraint, cpFloat max); /// @} + +#endif --- a/include/chipmunk/cpShape.h +++ b/include/chipmunk/cpShape.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_SHAPE_H +#define CP_SHAPE_H + /// @defgroup cpShape cpShape /// The cpShape struct defines the shape of a rigid body. /// @{ @@ -197,3 +200,5 @@ CP_EXPORT cpFloat cpSegmentShapeGetRadius(const cpShape *shape); /// @} + +#endif --- a/include/chipmunk/cpSimpleMotor.h +++ b/include/chipmunk/cpSimpleMotor.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_SIMPLE_MOTOR_H +#define CP_SIMPLE_MOTOR_H + /// @defgroup cpSimpleMotor cpSimpleMotor /// @{ @@ -41,3 +44,5 @@ CP_EXPORT void cpSimpleMotorSetRate(cpConstraint *constraint, cpFloat rate); /// @} + +#endif --- a/include/chipmunk/cpSlideJoint.h +++ b/include/chipmunk/cpSlideJoint.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_SLIDE_JOINT_H +#define CP_SLIDE_JOINT_H + /// @defgroup cpSlideJoint cpSlideJoint /// @{ @@ -53,3 +56,5 @@ CP_EXPORT void cpSlideJointSetMax(cpConstraint *constraint, cpFloat max); /// @} + +#endif --- a/include/chipmunk/cpSpace.h +++ b/include/chipmunk/cpSpace.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_SPACE_H +#define CP_SPACE_H + /// @defgroup cpSpace cpSpace /// @{ @@ -317,3 +320,5 @@ #endif /// @} + +#endif --- a/include/chipmunk/cpSpatialIndex.h +++ b/include/chipmunk/cpSpatialIndex.h @@ -19,6 +19,9 @@ * SOFTWARE. */ +#ifndef CP_SPATIAL_INDEX_H +#define CP_SPATIAL_INDEX_H + /** @defgroup cpSpatialIndex cpSpatialIndex @@ -225,3 +228,5 @@ } ///@} + +#endif