summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2018-01-23 12:30:34 -0500
committerBernard Normier <bernard@zeroc.com>2018-01-23 12:30:34 -0500
commita03cc8a25e9550e09090fea370d1af86df1a6aff (patch)
treebb7ae4a376a9e638a99b29c05d8abc2d7b7a92e9
parentUpdated UWP test controller certificate (diff)
downloadice-a03cc8a25e9550e09090fea370d1af86df1a6aff.tar.bz2
ice-a03cc8a25e9550e09090fea370d1af86df1a6aff.tar.xz
ice-a03cc8a25e9550e09090fea370d1af86df1a6aff.zip
Added strict prototypes (ICE-8613)
-rw-r--r--config/Make.rules.Darwin2
-rw-r--r--cpp/src/slice2objc/Gen.cpp4
-rw-r--r--objective-c/include/objc/Ice/Proxy.h10
-rw-r--r--objective-c/test/Ice/ami/AllTests.m14
-rw-r--r--objective-c/test/Ice/defaultValue/Client.m2
-rw-r--r--objective-c/test/Ice/hash/Client.m2
-rw-r--r--objective-c/test/Ice/hold/TestI.h2
-rw-r--r--objective-c/test/Ice/hold/TestI.m2
-rw-r--r--objective-c/test/Ice/metrics/AllTests.m2
-rw-r--r--objective-c/test/Ice/objects/AllTests.m6
-rw-r--r--objective-c/test/include/TestCommon.h6
11 files changed, 28 insertions, 24 deletions
diff --git a/config/Make.rules.Darwin b/config/Make.rules.Darwin
index 9ddc7c34ecc..e4d8ea73e5e 100644
--- a/config/Make.rules.Darwin
+++ b/config/Make.rules.Darwin
@@ -33,7 +33,7 @@ iphonesimulator_targetdir = $(if $(filter %/build,$5),/iphonesimulator)
# If building objects for a shared library, enable fPIC
shared_cppflags = $(if $(filter-out program,$($1_target)),-fPIC) -fvisibility=hidden
-cppflags = -Wall -Wdeprecated -Werror -pthread $(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g)
+cppflags = -Wall -Wdeprecated -Wstrict-prototypes -Werror -pthread $(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g)
ifeq ($(MAXWARN),yes)
cppflags += -Wextra -Wshadow -Wredundant-decls -Wweak-vtables
endif
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp
index 1c4b7e58943..55a587bb441 100644
--- a/cpp/src/slice2objc/Gen.cpp
+++ b/cpp/src/slice2objc/Gen.cpp
@@ -579,6 +579,10 @@ Slice::ObjCVisitor::getResponseCBSig(const OperationPtr& op) const
result += outTypeToString(type, (*q)->optional());
}
}
+ if(result.empty())
+ {
+ result = "void";
+ }
return "void(^)(" + result + ")";
}
diff --git a/objective-c/include/objc/Ice/Proxy.h b/objective-c/include/objc/Ice/Proxy.h
index 79dbf98eecb..2dcc18ab105 100644
--- a/objective-c/include/objc/Ice/Proxy.h
+++ b/objective-c/include/objc/Ice/Proxy.h
@@ -73,10 +73,10 @@ ICE_API @protocol ICEObjectPrx <NSObject, NSCopying>
-(void) ice_ping:(ICEContext*)context;
-(id<ICEAsyncResult>) begin_ice_ping;
-(id<ICEAsyncResult>) begin_ice_ping:(ICEContext*)context;
--(id<ICEAsyncResult>) begin_ice_ping:(void(^)())response exception:(void(^)(ICEException*))exception;
--(id<ICEAsyncResult>) begin_ice_ping:(ICEContext*)context response:(void(^)())response exception:(void(^)(ICEException*))exception;
--(id<ICEAsyncResult>) begin_ice_ping:(void(^)())response exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent;
--(id<ICEAsyncResult>) begin_ice_ping:(ICEContext*)context response:(void(^)())response exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent;
+-(id<ICEAsyncResult>) begin_ice_ping:(void(^)(void))response exception:(void(^)(ICEException*))exception;
+-(id<ICEAsyncResult>) begin_ice_ping:(ICEContext*)context response:(void(^)(void))response exception:(void(^)(ICEException*))exception;
+-(id<ICEAsyncResult>) begin_ice_ping:(void(^)(void))response exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent;
+-(id<ICEAsyncResult>) begin_ice_ping:(ICEContext*)context response:(void(^)(void))response exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent;
-(void) end_ice_ping:(id<ICEAsyncResult>)result;
-(NSMutableArray*) ice_ids;
-(NSMutableArray*) ice_ids:(ICEContext*)context;
@@ -180,7 +180,7 @@ ICE_API @interface ICEObjectPrx : NSObject<ICEObjectPrx>
-(id<ICEAsyncResult>) iceI_begin_invoke:(NSString*)operation mode:(ICEOperationMode)mode format:(ICEFormatType)format marshal:(ICEMarshalCB)marshal
returnsData:(BOOL)returnsData context:(ICEContext*)context;
-(id<ICEAsyncResult>) iceI_begin_invoke:(NSString*)operation mode:(ICEOperationMode)mode format:(ICEFormatType)format marshal:(ICEMarshalCB)marshal
- response:(void(^)())response
+ response:(void(^)(void))response
exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent
context:(ICEContext*)context;
-(id<ICEAsyncResult>) iceI_begin_invoke:(NSString*)operation mode:(ICEOperationMode)mode format:(ICEFormatType)format marshal:(ICEMarshalCB)marshal
diff --git a/objective-c/test/Ice/ami/AllTests.m b/objective-c/test/Ice/ami/AllTests.m
index ebecf494d47..a9be5fda24f 100644
--- a/objective-c/test/Ice/ami/AllTests.m
+++ b/objective-c/test/Ice/ami/AllTests.m
@@ -161,7 +161,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
[p begin_ice_isA:[TestAMITestIntfPrx ice_staticId] context:ctx response:isACB exception:exCB];
[cb check];
- void (^pingCB)() = ^ { [cb called]; };
+ void (^pingCB)(void) = ^ { [cb called]; };
[p begin_ice_ping:pingCB exception:exCB];
[cb check];
[p begin_ice_ping:ctx response:pingCB exception:exCB];
@@ -201,7 +201,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
[cb check];
}
- void (^opCB)() = ^ { [cb called]; };
+ void (^opCB)(void) = ^ { [cb called]; };
[p begin_op:opCB exception:exCB];
[cb check];
[p begin_op:ctx response:opCB exception:exCB];
@@ -219,7 +219,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
[p begin_opWithResult:ctx response:opWithResultCB exception:exCB];
[cb check];
- void (^opWithUE)() = ICE_AUTORELEASE([ ^() { test(NO); } copy]);
+ void (^opWithUE)(void) = ICE_AUTORELEASE([ ^(void) { test(NO); } copy]);
void (^opWithUEEx)(ICEException*) = ^(ICEException* ex)
{
@try
@@ -330,7 +330,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
[i begin_ice_isA:@"dummy" context:ctx response:isACB exception:exCB];
[cb check];
- void (^pingCB)() = ICE_AUTORELEASE([ ^ { test(NO); } copy ]);
+ void (^pingCB)(void) = ICE_AUTORELEASE([ ^ { test(NO); } copy ]);
[i begin_ice_ping:pingCB exception:exCB];
[cb check];
[i begin_ice_ping:ctx response:pingCB exception:exCB];
@@ -355,7 +355,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
[cb check];
}
- void (^opCB)() = ICE_AUTORELEASE([ ^ { test(NO); } copy ]);
+ void (^opCB)(void) = ICE_AUTORELEASE([ ^ { test(NO); } copy ]);
[i begin_op:opCB exception:exCB];
[cb check];
[i begin_op:ctx response:opCB exception:exCB];
@@ -489,7 +489,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
{
id<TestAMITestIntfPrx> q = [TestAMITestIntfPrx uncheckedCast:[p ice_adapterId:@"dummy"]];
TestAMICallback* cb = [TestAMICallback create];
- void (^thrower)() = ^(int i)
+ void (^thrower)(int) = ^(int i)
{
[cb called];
switch(i)
@@ -517,7 +517,7 @@ amiAllTests(id<ICECommunicator> communicator, BOOL collocated)
int i;
for(i = 0; i < 3; ++i)
{
- void (^throwResponse)() = ^{ thrower(i); };
+ void (^throwResponse)(void) = ^{ thrower(i); };
void (^throwEx)(ICEException*) = ^(ICEException* ex){ thrower(i); };
void (^throwSent)(BOOL) = ^(BOOL b){ thrower(i); };
diff --git a/objective-c/test/Ice/defaultValue/Client.m b/objective-c/test/Ice/defaultValue/Client.m
index 883f9705a66..c95c491aa93 100644
--- a/objective-c/test/Ice/defaultValue/Client.m
+++ b/objective-c/test/Ice/defaultValue/Client.m
@@ -14,7 +14,7 @@
static int
run()
{
- void defaultValueAllTests();
+ void defaultValueAllTests(void);
defaultValueAllTests();
return EXIT_SUCCESS;
}
diff --git a/objective-c/test/Ice/hash/Client.m b/objective-c/test/Ice/hash/Client.m
index 451ea359303..703a867a648 100644
--- a/objective-c/test/Ice/hash/Client.m
+++ b/objective-c/test/Ice/hash/Client.m
@@ -14,7 +14,7 @@
static int
run()
{
- void hashAllTests();
+ void hashAllTests(void);
hashAllTests();
return EXIT_SUCCESS;
}
diff --git a/objective-c/test/Ice/hold/TestI.h b/objective-c/test/Ice/hold/TestI.h
index cdf8397c4f3..be616259120 100644
--- a/objective-c/test/Ice/hold/TestI.h
+++ b/objective-c/test/Ice/hold/TestI.h
@@ -15,7 +15,7 @@
{
dispatch_queue_t queue;
}
--(void) schedule:(void(^)())callback timeout:(ICEInt)timeout;
+-(void) schedule:(void(^)(void))callback timeout:(ICEInt)timeout;
@end
@interface HoldI : TestHoldHold<TestHoldHold>
diff --git a/objective-c/test/Ice/hold/TestI.m b/objective-c/test/Ice/hold/TestI.m
index 2a5cc0d1501..3c219fea2a2 100644
--- a/objective-c/test/Ice/hold/TestI.m
+++ b/objective-c/test/Ice/hold/TestI.m
@@ -30,7 +30,7 @@
[super dealloc];
}
#endif
--(void) schedule:(void(^)())callback timeout:(ICEInt)t
+-(void) schedule:(void(^)(void))callback timeout:(ICEInt)t
{
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, t * NSEC_PER_MSEC), DISPATCH_TIME_FOREVER, 0);
diff --git a/objective-c/test/Ice/metrics/AllTests.m b/objective-c/test/Ice/metrics/AllTests.m
index 57ef77cc91b..a6342d6ea2e 100644
--- a/objective-c/test/Ice/metrics/AllTests.m
+++ b/objective-c/test/Ice/metrics/AllTests.m
@@ -928,7 +928,7 @@ metricsAllTests(id<ICECommunicator> communicator)
Callback* cb = [Callback callback];
- void(^responseCB)() = ^()
+ void(^responseCB)(void) = ^()
{
[cb response];
};
diff --git a/objective-c/test/Ice/objects/AllTests.m b/objective-c/test/Ice/objects/AllTests.m
index 8a0f168fa1d..3ba64740cc6 100644
--- a/objective-c/test/Ice/objects/AllTests.m
+++ b/objective-c/test/Ice/objects/AllTests.m
@@ -16,9 +16,9 @@
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
-void breakRetainCycleB();
-void breakRetainCycleC();
-void breakRetainCycleD();
+void breakRetainCycleB(TestObjectsB* b1);
+void breakRetainCycleC(TestObjectsC* c1);
+void breakRetainCycleD(TestObjectsD* d1);
void breakRetainCycleB(TestObjectsB* b1)
{
diff --git a/objective-c/test/include/TestCommon.h b/objective-c/test/include/TestCommon.h
index 7fcdfa44440..3dd5d96814d 100644
--- a/objective-c/test/include/TestCommon.h
+++ b/objective-c/test/include/TestCommon.h
@@ -32,12 +32,12 @@ TEST_API void TestCommonTestInit(id, SEL, NSString*, BOOL, BOOL);
@protocol ICECommunicator;
@protocol ICEProperties;
-TEST_API id<ICEProperties> defaultServerProperties();
-TEST_API id<ICEProperties> defaultClientProperties();
+TEST_API id<ICEProperties> defaultServerProperties(int* argc, char** argv);
+TEST_API id<ICEProperties> defaultClientProperties(int* argc, char** argv);
TEST_API void serverReady(id<ICECommunicator>);
-TEST_API void serverStop();
+TEST_API void serverStop(void);
TEST_API void tprintf(const char* fmt, ...);