------------------------------------------------------------ revno: 14091 revision-id: squid3@treenet.co.nz-20160924223605-2xa0er35fx3dc8jg parent: squid3@treenet.co.nz-20160923204924-28rxvvbloccrma6a fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=4594 committer: Amos Jeffries branch nick: 3.5 timestamp: Sun 2016-09-25 11:36:05 +1300 message: Bug 4594: build failure with clang 3.9 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20160924223605-2xa0er35fx3dc8jg # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: b9120ddecb08a583e07444c422722e48e8034d21 # timestamp: 2016-09-24 22:51:01 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20160923204924-\ # 28rxvvbloccrma6a # # Begin patch === modified file 'src/adaptation/ecap/XactionRep.cc' --- src/adaptation/ecap/XactionRep.cc 2016-01-01 00:14:27 +0000 +++ src/adaptation/ecap/XactionRep.cc 2016-09-24 22:36:05 +0000 @@ -726,7 +726,7 @@ buf.append(" A?", 3); } - buf.Printf(" %s%u]", id.Prefix, id.value); + buf.Printf(" %s%u]", id.prefix(), id.value); buf.terminate(); === modified file 'src/adaptation/icap/Xaction.cc' --- src/adaptation/icap/Xaction.cc 2016-01-01 00:14:27 +0000 +++ src/adaptation/icap/Xaction.cc 2016-09-24 22:36:05 +0000 @@ -598,9 +598,7 @@ fillPendingStatus(buf); buf.append("/", 1); fillDoneStatus(buf); - - buf.Printf(" %s%u]", id.Prefix, id.value); - + buf.Printf(" %s%u]", id.prefix(), id.value); buf.terminate(); return buf.content(); === modified file 'src/base/AsyncJob.cc' --- src/base/AsyncJob.cc 2016-01-01 00:14:27 +0000 +++ src/base/AsyncJob.cc 2016-09-24 22:36:05 +0000 @@ -164,7 +164,7 @@ buf.Printf("Stopped, reason:"); buf.Printf("%s",stopReason); } - buf.Printf(" %s%u]", id.Prefix, id.value); + buf.Printf(" %s%u]", id.prefix(), id.value); buf.terminate(); return buf.content(); === modified file 'src/base/InstanceId.h' --- src/base/InstanceId.h 2016-01-01 00:14:27 +0000 +++ src/base/InstanceId.h 2016-09-24 22:36:05 +0000 @@ -25,35 +25,41 @@ public: typedef unsigned int Value; ///< id storage type; \todo: parameterize? - InstanceId(): value(++Last ? Last : ++Last) {} + InstanceId(): value(0) {change();} operator Value() const { return value; } bool operator ==(const InstanceId &o) const { return value == o.value; } bool operator !=(const InstanceId &o) const { return !(*this == o); } - void change() {value = ++Last ? Last : ++Last;} + void change(); - /// prints Prefix followed by ID value; \todo: use HEX for value printing? + /// prints class-pecific prefix followed by ID value; \todo: use HEX for value printing? std::ostream &print(std::ostream &os) const; + /// returns the class-pecific prefix + const char * const prefix() const; + public: - static const char *Prefix; ///< Class shorthand string for debugging Value value; ///< instance identifier private: InstanceId(const InstanceId& right); ///< not implemented; IDs are unique InstanceId& operator=(const InstanceId &right); ///< not implemented - -private: - static Value Last; ///< the last used ID value }; /// convenience macro to instantiate Class-specific stuff in .cc files -#define InstanceIdDefinitions(Class, prefix) \ - template<> const char *InstanceId::Prefix = prefix; \ - template<> InstanceId::Value InstanceId::Last = 0; \ +#define InstanceIdDefinitions(Class, pfx) \ + template<> const char * const \ + InstanceId::prefix() const { \ + return pfx; \ + } \ template<> std::ostream & \ InstanceId::print(std::ostream &os) const { \ - return os << Prefix << value; \ + return os << pfx << value; \ + } \ + template<> void \ + InstanceId::change() { \ + static InstanceId::Value Last = 0; \ + value = ++Last ? Last : ++Last; \ } /// print the id === modified file 'src/ssl/PeerConnector.cc' --- src/ssl/PeerConnector.cc 2016-05-21 17:29:19 +0000 +++ src/ssl/PeerConnector.cc 2016-09-24 22:36:05 +0000 @@ -771,7 +771,7 @@ } if (serverConn != NULL) buf.Printf(" FD %d", serverConn->fd); - buf.Printf(" %s%u]", id.Prefix, id.value); + buf.Printf(" %s%u]", id.prefix(), id.value); buf.terminate(); return buf.content();