Updated Branches: refs/heads/master aa09ec6d9 -> af7e88d81
TS-1116 More fixes to build with clang on OSX Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/af7e88d8 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/af7e88d8 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/af7e88d8 Branch: refs/heads/master Commit: af7e88d819e3e621f860d0dda6cb7e2cbf5e7c16 Parents: aa09ec6 Author: Leif Hedstrom <[email protected]> Authored: Mon Feb 20 12:29:58 2012 -0700 Committer: Leif Hedstrom <[email protected]> Committed: Mon Feb 20 12:29:58 2012 -0700 ---------------------------------------------------------------------- configure.ac | 35 +++++++++++------ lib/ts/IpMap.cc | 101 +++++++++++++++++++++++++------------------------- 2 files changed, 74 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/af7e88d8/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 797e94a..03b0b57 100644 --- a/configure.ac +++ b/configure.ac @@ -568,7 +568,7 @@ base_cc=`basename $CC` case $host_os in linux*) case $base_cc in - icc) + icc) # -Wall goes crazy, so turned these specific checks off for now: # # 111 is "statement is unrecahable" @@ -590,30 +590,41 @@ case $host_os in debug_opt="-ggdb3 $common_opt" release_opt="-g $common_opt $optimization_flags -axsse4.2 -fno-strict-aliasing" cxx_opt="-Wno-invalid-offsetof" - ;; + ;; clang) debug_opt="-ggdb3 $common_opt -Qunused-arguments" - release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing -Qunused-arguments" + release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing -Qunused-arguments" cxx_opt="-Wno-invalid-offsetof -Qunused-arguments" - ;; + ;; *) # gcc - # This is useful for finding odd conversions - # common_opt="-pipe -Wall -Werror -Wconversion -Wno-sign-conversion" + # This is useful for finding odd conversions + # common_opt="-pipe -Wall -Werror -Wconversion -Wno-sign-conversion" common_opt="-pipe -Wall -Werror" debug_opt="-ggdb3 $common_opt" release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing" cxx_opt="-Wno-invalid-offsetof" ;; - esac + esac ;; # linux*) darwin*) - common_opt="-pipe -Wall -Werror -Wno-deprecated-declarations" - debug_opt="-ggdb3 $common_opt" - release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing" - cxx_opt="-Wno-invalid-offsetof" + case $base_cc in + clang) + common_opt="-pipe -Wall -Werror -Wno-deprecated-declarations" + debug_opt="-ggdb3 $common_opt" + release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing" + cxx_opt="-Wno-invalid-offsetof" + ;; + *) # gcc + common_opt="-pipe -Wall -Werror -Wno-deprecated-declarations" + debug_opt="-ggdb3 $common_opt" + release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing" + cxx_opt="-Wno-invalid-offsetof" + ;; + esac + # ToDo: This seems semi-kludgy, but useful for MacPort's I think. TS_ADDTO(CPPFLAGS, [-I/opt/local/include]) TS_ADDTO(LDFLAGS, [-L/opt/local/lib]) - ;; + ;; # darwin*) freebsd*|kfreebsd*) common_opt="-pipe -Wall -Werror" debug_opt="-ggdb3 $common_opt" http://git-wip-us.apache.org/repos/asf/trafficserver/blob/af7e88d8/lib/ts/IpMap.cc ---------------------------------------------------------------------- diff --git a/lib/ts/IpMap.cc b/lib/ts/IpMap.cc index 564926d..1a61cc7 100644 --- a/lib/ts/IpMap.cc +++ b/lib/ts/IpMap.cc @@ -506,6 +506,57 @@ template < NodeList _list; }; +// Helper functions + +inline int cmp(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { + return memcmp(lhs.sin6_addr.s6_addr, rhs.sin6_addr.s6_addr, INK_IP6_SIZE); +} + +/// Less than. +inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { + return -1 == ts::detail::cmp(lhs, rhs); +} +inline bool operator<(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) { + return -1 == ts::detail::cmp(*lhs, rhs); +} +/// Less than. +inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { + return -1 == ts::detail::cmp(lhs, *rhs); +} +/// Equality. +inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { + return 0 == ts::detail::cmp(lhs, *rhs); +} +/// Equality. +inline bool operator==(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) { + return 0 == ts::detail::cmp(*lhs, rhs); +} +/// Equality. +inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { + return 0 == ts::detail::cmp(lhs, rhs); +} +/// Less than or equal. +inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { + return 1 != ts::detail::cmp(lhs, *rhs); +} +/// Less than or equal. +inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { + return 1 != ts::detail::cmp(lhs, rhs); +} +/// Greater than or equal. +inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { + return -1 != ts::detail::cmp(lhs, rhs); +} +/// Greater than or equal. +inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { + return -1 != ts::detail::cmp(lhs, *rhs); +} +/// Greater than. +inline bool operator>(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { + return 1 == ts::detail::cmp(lhs, *rhs); +} + + template < typename N > N* IpMapBase<N>::lowerBound(ArgType target) { N* n = _root; // current node to test. @@ -1151,56 +1202,6 @@ protected: }; -inline int cmp(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { - return memcmp(lhs.sin6_addr.s6_addr, rhs.sin6_addr.s6_addr, INK_IP6_SIZE); -} - -// Helper functions - -/// Less than. -inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { - return -1 == ts::detail::cmp(lhs, rhs); -} -inline bool operator<(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) { - return -1 == ts::detail::cmp(*lhs, rhs); -} -/// Less than. -inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { - return -1 == ts::detail::cmp(lhs, *rhs); -} -/// Equality. -inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { - return 0 == ts::detail::cmp(lhs, *rhs); -} -/// Equality. -inline bool operator==(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) { - return 0 == ts::detail::cmp(*lhs, rhs); -} -/// Equality. -inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { - return 0 == ts::detail::cmp(lhs, rhs); -} -/// Less than or equal. -inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { - return 1 != ts::detail::cmp(lhs, *rhs); -} -/// Less than or equal. -inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { - return 1 != ts::detail::cmp(lhs, rhs); -} -/// Greater than or equal. -inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) { - return -1 != ts::detail::cmp(lhs, rhs); -} -/// Greater than or equal. -inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { - return -1 != ts::detail::cmp(lhs, *rhs); -} -/// Greater than. -inline bool operator>(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) { - return 1 == ts::detail::cmp(lhs, *rhs); -} - // We declare this after the helper operators and inside this namespace // so that the template uses these for comparisons.
