Skip to content

Commit 427d553

Browse files
committed
Fixed unused parameter warnings in release builds.
1 parent 47989d7 commit 427d553

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

framework/Source/CPTDefinitions.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@
4242

4343
#define cpt_deprecated __attribute__((deprecated))
4444

45+
// Unused parameter attribute (DEBUG only)
46+
47+
/**
48+
* @def cpt_unused
49+
* @hideinitializer
50+
* @brief Marks a parameter value as unused only in RELEASE builds.
51+
**/
52+
53+
#ifdef DEBUG
54+
#define cpt_unused
55+
#else
56+
#define cpt_unused __unused
57+
#endif
58+
4559
// Swift wrappers
4660

4761
/**

framework/Source/CPTPlotSpace.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ -(NSUInteger)numberOfCoordinates
505505
* @param plotPoint An array of data point coordinates (as NSNumber values).
506506
* @return The drawing coordinates of the data point.
507507
**/
508-
-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint
508+
-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *cpt_unused)plotPoint
509509
{
510510
NSParameterAssert(plotPoint.count == self.numberOfCoordinates);
511511

@@ -517,7 +517,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint
517517
* @param count The number of coordinate values in the @par{plotPoint} array.
518518
* @return The drawing coordinates of the data point.
519519
**/
520-
-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger)count
520+
-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count
521521
{
522522
NSParameterAssert(count == self.numberOfCoordinates);
523523

@@ -529,7 +529,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *__unused)plotPoint n
529529
* @param count The number of coordinate values in the @par{plotPoint} array.
530530
* @return The drawing coordinates of the data point.
531531
**/
532-
-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger)count
532+
-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count
533533
{
534534
NSParameterAssert(count == self.numberOfCoordinates);
535535

@@ -550,7 +550,7 @@ -(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint __unused)poin
550550
* @param count The number of coordinate values in the @par{plotPoint} array.
551551
* @param point The drawing coordinates of the data point.
552552
**/
553-
-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint __unused)point
553+
-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point
554554
{
555555
NSParameterAssert(count == self.numberOfCoordinates);
556556
}
@@ -560,7 +560,7 @@ -(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSU
560560
* @param count The number of coordinate values in the @par{plotPoint} array.
561561
* @param point The drawing coordinates of the data point.
562562
**/
563-
-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint __unused)point
563+
-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point
564564
{
565565
NSParameterAssert(count == self.numberOfCoordinates);
566566
}
@@ -588,7 +588,7 @@ -(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *__unused)
588588
* @param count The number of coordinate values in the @par{plotPoint} array.
589589
* @param event The event.
590590
**/
591-
-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *__unused)event
591+
-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event
592592
{
593593
NSParameterAssert(count == self.numberOfCoordinates);
594594
}
@@ -598,7 +598,7 @@ -(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSU
598598
* @param count The number of coordinate values in the @par{plotPoint} array.
599599
* @param event The event.
600600
**/
601-
-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *__unused)event
601+
-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event
602602
{
603603
NSParameterAssert(count == self.numberOfCoordinates);
604604
}

0 commit comments

Comments
 (0)