diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml index 61f7d0afaea..3ec2ecf0245 100644 --- a/.github/workflows/clang_format.yml +++ b/.github/workflows/clang_format.yml @@ -20,13 +20,13 @@ jobs: # This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/ wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh chmod +x /tmp/llvm.sh - sudo /tmp/llvm.sh 18 - sudo apt-get install -y clang-format-18 + sudo /tmp/llvm.sh 19 + sudo apt-get install -y clang-format-19 rm /tmp/llvm.sh - clang-format-18 --version + clang-format-19 --version if: runner.os == 'Linux' - name: Run Clang Format run: | - find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.mm" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run - find cpp -name "*.m" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run + find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.mm" | xargs clang-format-19 --style=file --fallback-style=none --Werror --dry-run + find cpp -name "*.m" | xargs clang-format-19 --style=file --fallback-style=none --Werror --dry-run diff --git a/cpp/doxygen/examples/Ice/SSL/OpenSSLServerAuthenticationOptions.cpp b/cpp/doxygen/examples/Ice/SSL/OpenSSLServerAuthenticationOptions.cpp index 1ffbdaef053..9aa0b6c3bc3 100644 --- a/cpp/doxygen/examples/Ice/SSL/OpenSSLServerAuthenticationOptions.cpp +++ b/cpp/doxygen/examples/Ice/SSL/OpenSSLServerAuthenticationOptions.cpp @@ -37,7 +37,8 @@ serverSetNewSessionCallbackExample() "Hello", "ssl -h 127.0.0.1 -p 10000", Ice::SSL::ServerAuthenticationOptions{ - .sslNewSessionCallback = [](SSL* ssl, const std::string&) { + .sslNewSessionCallback = [](SSL* ssl, const std::string&) + { SSL_set_verify(ssl, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); }}); //! [sslNewSessionCallback] diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index 289a6588ab3..a063c6ac934 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -107,7 +107,7 @@ namespace IceInternal using TPtr = std::shared_ptr; using MetricsMapTPtr = std::shared_ptr; - typedef IceMX::MetricsMap MetricsType::*SubMapMember; + typedef IceMX::MetricsMap MetricsType::* SubMapMember; class EntryT; using EntryTPtr = std::shared_ptr; @@ -488,7 +488,7 @@ namespace IceInternal } template - void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::*member) + void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { _subMaps[subMap] = std::pair( member, @@ -554,7 +554,7 @@ namespace IceInternal } template - void registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::*member) + void registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { bool updated; std::shared_ptr> factory; diff --git a/cpp/include/Ice/MetricsFunctional.h b/cpp/include/Ice/MetricsFunctional.h index de5db75e34c..f7b5db4dd25 100644 --- a/cpp/include/Ice/MetricsFunctional.h +++ b/cpp/include/Ice/MetricsFunctional.h @@ -44,12 +44,12 @@ namespace IceMX /// \cond INTERNAL template struct ApplyOnMember { - ApplyOnMember(Y T::*m, Func f) : func(f), member(m) {} + ApplyOnMember(Y T::* m, Func f) : func(f), member(m) {} template void operator()(const R& v) { func(IceInternal::ReferenceWrapper::get(v)->*member); } Func func; - Y T::*member; + Y T::* member; }; template struct Decrement @@ -71,22 +71,22 @@ namespace IceMX T value; }; - template ApplyOnMember applyOnMember(Y T::*member, F func) + template ApplyOnMember applyOnMember(Y T::* member, F func) { return ApplyOnMember(member, func); } - template ApplyOnMember> add(Y T::*member, V value) + template ApplyOnMember> add(Y T::* member, V value) { return applyOnMember(member, Add(value)); } - template ApplyOnMember> inc(Y T::*member) + template ApplyOnMember> inc(Y T::* member) { return applyOnMember(member, Increment()); } - template ApplyOnMember> dec(Y T::*member) + template ApplyOnMember> dec(Y T::* member) { return applyOnMember(member, Decrement()); } diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h index 923d55ceca1..8a67399e1f2 100644 --- a/cpp/include/Ice/MetricsObserverI.h +++ b/cpp/include/Ice/MetricsObserverI.h @@ -110,7 +110,7 @@ namespace IceMX void setDefault(std::string (Helper::*memberFn)(const std::string&) const) { _default = memberFn; } - template void add(const std::string& name, Y Helper::*member) + template void add(const std::string& name, Y Helper::* member) { _attributes.insert(typename std::map::value_type( name, @@ -125,7 +125,7 @@ namespace IceMX } template - void add(const std::string& name, O (Helper::*getFn)() const, Y I::*member) + void add(const std::string& name, O (Helper::*getFn)() const, Y I::* member) { _attributes.insert(typename std::map::value_type( name, @@ -156,12 +156,12 @@ namespace IceMX template class HelperMemberResolver : public Resolver { public: - HelperMemberResolver(const std::string& name, Y Helper::*member) : Resolver(name), _member(member) {} + HelperMemberResolver(const std::string& name, Y Helper::* member) : Resolver(name), _member(member) {} virtual std::string operator()(const Helper* r) const { return toString(r->*_member); } private: - Y Helper::*_member; + Y Helper::* _member; }; template class HelperMemberFunctionResolver : public Resolver @@ -182,7 +182,7 @@ namespace IceMX template class MemberResolver : public Resolver { public: - MemberResolver(const std::string& name, O (Helper::*getFn)() const, Y I::*member) + MemberResolver(const std::string& name, O (Helper::*getFn)() const, Y I::* member) : Resolver(name), _getFn(getFn), _member(member) @@ -205,7 +205,7 @@ namespace IceMX private: O (Helper::*_getFn)() const; - Y I::*_member; + Y I::* _member; }; template class MemberFunctionResolver : public Resolver @@ -521,7 +521,7 @@ namespace IceMX } template - void registerSubMap(const std::string& subMap, MetricsMap MetricsType::*member) + void registerSubMap(const std::string& subMap, MetricsMap MetricsType::* member) { assert(_metrics); _metrics->registerSubMap(_name, subMap, member); diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index f84bd315a55..8355068e2fe 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1467,7 +1467,8 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) connectionStartCompleted = std::move(connectionStartCompleted), sentCBs = std::move(sentCBs), messageUpcall = std::move(messageUpcall), - stream]() { + stream]() + { self->upcall( std::move(connectionStartCompleted), std::move(sentCBs), diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp index 1654fa80feb..328666f5b26 100644 --- a/cpp/src/Ice/InstrumentationI.cpp +++ b/cpp/src/Ice/InstrumentationI.cpp @@ -20,7 +20,7 @@ using namespace IceMX; namespace { - int ThreadMetrics::*getThreadStateMetric(ThreadState s) + int ThreadMetrics::* getThreadStateMetric(ThreadState s) { switch (s) { diff --git a/cpp/src/Ice/OutputUtil.h b/cpp/src/Ice/OutputUtil.h index d869efdc43b..d604a8fb61b 100644 --- a/cpp/src/Ice/OutputUtil.h +++ b/cpp/src/Ice/OutputUtil.h @@ -69,14 +69,10 @@ namespace IceInternal bool _separator; }; - class ICE_API NextLine - { - }; + class ICE_API NextLine{}; extern ICE_API NextLine nl; - class ICE_API Separator - { - }; + class ICE_API Separator{}; extern ICE_API Separator sp; // ---------------------------------------------------------------------- @@ -136,9 +132,7 @@ namespace IceInternal return o; } - class ICE_API StartBlock - { - }; + class ICE_API StartBlock{}; extern ICE_API StartBlock sb; template<> inline Output& operator<<(Output& o, const StartBlock&) @@ -147,9 +141,7 @@ namespace IceInternal return o; } - class ICE_API EndBlock - { - }; + class ICE_API EndBlock{}; extern ICE_API EndBlock eb; template<> inline Output& operator<<(Output& o, const EndBlock&) @@ -158,9 +150,7 @@ namespace IceInternal return o; } - class ICE_API StartPar - { - }; + class ICE_API StartPar{}; extern ICE_API StartPar spar; template<> inline Output& operator<<(Output& o, const StartPar&) @@ -169,9 +159,7 @@ namespace IceInternal return o; } - class ICE_API EndPar - { - }; + class ICE_API EndPar{}; extern ICE_API EndPar epar; template<> inline Output& operator<<(Output& o, const EndPar&) @@ -180,9 +168,7 @@ namespace IceInternal return o; } - class ICE_API StartAbrk - { - }; + class ICE_API StartAbrk{}; extern ICE_API StartAbrk sabrk; template<> inline Output& operator<<(Output& o, const StartAbrk&) @@ -191,9 +177,7 @@ namespace IceInternal return o; } - class ICE_API EndAbrk - { - }; + class ICE_API EndAbrk{}; extern ICE_API EndAbrk eabrk; template<> inline Output& operator<<(Output& o, const EndAbrk&) @@ -259,9 +243,7 @@ namespace IceInternal return o; } - class ICE_API EndElement - { - }; + class ICE_API EndElement{}; extern ICE_API EndElement ee; template<> inline XMLOutput& operator<<(XMLOutput& o, const EndElement&) @@ -310,14 +292,10 @@ namespace IceInternal return o; } - class ICE_API StartEscapes - { - }; + class ICE_API StartEscapes{}; extern ICE_API StartEscapes startEscapes; - class ICE_API EndEscapes - { - }; + class ICE_API EndEscapes{}; extern ICE_API EndEscapes endEscapes; template<> inline XMLOutput& operator<<(XMLOutput& o, const StartEscapes&) diff --git a/cpp/test/ios/controller/Classes/AppDelegate.m b/cpp/test/ios/controller/Classes/AppDelegate.m index e16ba6e02f8..9d82a3b43d3 100644 --- a/cpp/test/ios/controller/Classes/AppDelegate.m +++ b/cpp/test/ios/controller/Classes/AppDelegate.m @@ -4,8 +4,7 @@ #import "AppDelegate.h" -@interface -AppDelegate () +@interface AppDelegate () @end diff --git a/swift/src/IceImpl/include/Communicator.h b/swift/src/IceImpl/include/Communicator.h index 6d7998351a2..db714df0e01 100644 --- a/swift/src/IceImpl/include/Communicator.h +++ b/swift/src/IceImpl/include/Communicator.h @@ -60,8 +60,7 @@ ICEIMPL_API @interface ICECommunicator : ICELocalObject #ifdef __cplusplus -@interface -ICECommunicator () +@interface ICECommunicator () @property(nonatomic, readonly) std::shared_ptr communicator; @end diff --git a/swift/src/IceImpl/include/Connection.h b/swift/src/IceImpl/include/Connection.h index 11ada38e9d2..134f551a3f3 100644 --- a/swift/src/IceImpl/include/Connection.h +++ b/swift/src/IceImpl/include/Connection.h @@ -96,8 +96,7 @@ ICEIMPL_API @protocol ICEConnectionInfoFactory id createConnectionInfo(std::shared_ptr); -@interface -ICEConnection () +@interface ICEConnection () @property(nonatomic, readonly) std::shared_ptr connection; @end diff --git a/swift/src/IceImpl/include/Endpoint.h b/swift/src/IceImpl/include/Endpoint.h index a831317549b..2b04e9f0876 100644 --- a/swift/src/IceImpl/include/Endpoint.h +++ b/swift/src/IceImpl/include/Endpoint.h @@ -70,14 +70,12 @@ ICEIMPL_API @protocol ICEEndpointInfoFactory #ifdef __cplusplus -@interface -ICEEndpoint () +@interface ICEEndpoint () @property(nonatomic, readonly) std::shared_ptr endpoint; + (nullable ICEEndpointInfo*)createEndpointInfo:(std::shared_ptr)infoPtr NS_RETURNS_RETAINED; @end -@interface -ICEEndpointInfo () +@interface ICEEndpointInfo () @property(nonatomic, readonly) std::shared_ptr info; @end diff --git a/swift/src/IceImpl/include/ImplicitContext.h b/swift/src/IceImpl/include/ImplicitContext.h index b2aaea6fefa..c380c615035 100644 --- a/swift/src/IceImpl/include/ImplicitContext.h +++ b/swift/src/IceImpl/include/ImplicitContext.h @@ -14,8 +14,7 @@ ICEIMPL_API @interface ICEImplicitContext : ICELocalObject #ifdef __cplusplus -@interface -ICEImplicitContext () +@interface ICEImplicitContext () @property(nonatomic, readonly) std::shared_ptr implicitContext; @end diff --git a/swift/src/IceImpl/include/LocalObject.h b/swift/src/IceImpl/include/LocalObject.h index 844c9dbbb48..09e6bcab14f 100644 --- a/swift/src/IceImpl/include/LocalObject.h +++ b/swift/src/IceImpl/include/LocalObject.h @@ -14,8 +14,7 @@ ICEIMPL_API @interface ICELocalObject : NSObject #ifdef __cplusplus -@interface -ICELocalObject () +@interface ICELocalObject () @property(nonatomic, readonly) std::shared_ptr cppObject; + (nullable instancetype)getHandle:(std::shared_ptr)cppObject NS_RETURNS_RETAINED; @end diff --git a/swift/src/IceImpl/include/Logger.h b/swift/src/IceImpl/include/Logger.h index 74c04e2db0c..5a805ebb487 100644 --- a/swift/src/IceImpl/include/Logger.h +++ b/swift/src/IceImpl/include/Logger.h @@ -23,8 +23,7 @@ ICEIMPL_API @interface ICELogger : ICELocalObject #ifdef __cplusplus -@interface -ICELogger () +@interface ICELogger () @property(nonatomic, readonly) std::shared_ptr logger; @end diff --git a/swift/src/IceImpl/include/ObjectAdapter.h b/swift/src/IceImpl/include/ObjectAdapter.h index 34163c4638b..ce59fd7e385 100644 --- a/swift/src/IceImpl/include/ObjectAdapter.h +++ b/swift/src/IceImpl/include/ObjectAdapter.h @@ -41,8 +41,7 @@ ICEIMPL_API @interface ICEObjectAdapter : ICELocalObject #ifdef __cplusplus -@interface -ICEObjectAdapter () +@interface ICEObjectAdapter () @property(nonatomic, readonly) std::shared_ptr objectAdapter; @end diff --git a/swift/src/IceImpl/include/ObjectPrx.h b/swift/src/IceImpl/include/ObjectPrx.h index 5a4102e523b..15b4010d0a2 100644 --- a/swift/src/IceImpl/include/ObjectPrx.h +++ b/swift/src/IceImpl/include/ObjectPrx.h @@ -110,8 +110,7 @@ ICEIMPL_API @interface ICEObjectPrx : NSObject #ifdef __cplusplus -@interface -ICEObjectPrx () +@interface ICEObjectPrx () // prx is always set; we just need a field with a default constructor. @property(nonatomic, readonly) std::optional prx; - (nonnull instancetype)initWithCppObjectPrx:(const Ice::ObjectPrx&)prx; diff --git a/swift/src/IceImpl/include/Process.h b/swift/src/IceImpl/include/Process.h index 70a05c9381e..1be32de60d0 100644 --- a/swift/src/IceImpl/include/Process.h +++ b/swift/src/IceImpl/include/Process.h @@ -10,8 +10,7 @@ ICEIMPL_API @interface ICEProcess : ICELocalObject #ifdef __cplusplus -@interface -ICEProcess () +@interface ICEProcess () @property(nonatomic, readonly) std::shared_ptr process; @end diff --git a/swift/src/IceImpl/include/Properties.h b/swift/src/IceImpl/include/Properties.h index 0b6afe8badc..47ddd12cf12 100644 --- a/swift/src/IceImpl/include/Properties.h +++ b/swift/src/IceImpl/include/Properties.h @@ -31,8 +31,7 @@ ICEIMPL_API @interface ICEProperties : ICELocalObject #ifdef __cplusplus -@interface -ICEProperties () +@interface ICEProperties () @property(nonatomic, readonly) std::shared_ptr properties; @end diff --git a/swift/src/IceImpl/include/PropertiesAdmin.h b/swift/src/IceImpl/include/PropertiesAdmin.h index d014ebfe7e0..ca97004766d 100644 --- a/swift/src/IceImpl/include/PropertiesAdmin.h +++ b/swift/src/IceImpl/include/PropertiesAdmin.h @@ -12,8 +12,7 @@ ICEIMPL_API @interface ICEPropertiesAdmin : ICELocalObject #ifdef __cplusplus -@interface -ICEPropertiesAdmin () +@interface ICEPropertiesAdmin () @property(nonatomic, readonly) std::shared_ptr propertiesAdmin; @end