You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2012/02/19 05:35:37 UTC

git commit: TS-1116 Some fixes for clang/llvm, on OSX

Updated Branches:
  refs/heads/master ef63f9f68 -> 19f367381


TS-1116 Some fixes for clang/llvm, on OSX


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/19f36738
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/19f36738
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/19f36738

Branch: refs/heads/master
Commit: 19f3673812d38704d9387dbbffc4c82b4c275f37
Parents: ef63f9f
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Feb 18 21:35:23 2012 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Feb 18 21:35:23 2012 -0700

----------------------------------------------------------------------
 iocore/cache/CacheHosting.cc |    4 ++--
 lib/ts/Allocator.h           |    4 ++--
 lib/ts/IpMap.cc              |    4 ++--
 lib/ts/ink_atomic.h          |    2 +-
 lib/ts/ink_auth_api.cc       |    2 +-
 lib/ts/ink_inet.h            |    2 +-
 proxy/ControlMatcher.cc      |    2 +-
 proxy/InkAPITest.cc          |    5 ++++-
 8 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/iocore/cache/CacheHosting.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index c9d316f..f1b32cc 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -512,7 +512,7 @@ CacheHostRecord::Init(matcher_line * line_info, int typ)
 
       /* first find out the number of volumes */
       while (*s) {
-        if ((*s == ',')) {
+        if (*s == ',') {
           num_cachevols++;
           s++;
           if (!(*s)) {
@@ -554,7 +554,7 @@ CacheHostRecord::Init(matcher_line * line_info, int typ)
           for (; cachep; cachep = cachep->link.next) {
             if (cachep->vol_number == volume_number) {
               is_vol_present = 1;
-              if ((cachep->scheme == type)) {
+              if (cachep->scheme == type) {
                 Debug("cache_hosting",
                       "Host Record: %p, Volume: %d, size: %ld",
                       this, volume_number, (long)(cachep->size * STORE_BLOCK_SIZE));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/Allocator.h
----------------------------------------------------------------------
diff --git a/lib/ts/Allocator.h b/lib/ts/Allocator.h
index beb7153..5ee62ce 100644
--- a/lib/ts/Allocator.h
+++ b/lib/ts/Allocator.h
@@ -118,7 +118,7 @@ public:
       for (unsigned int i = 0; i < RND16(sizeof(C)) / sizeof(int64_t); i++)
         ((int64_t *) ptr)[i] = ((int64_t *) &this->proto.typeObject)[i];
     } else
-      memcpy(ptr, &this->proto.typeObject, sizeof(C));
+      memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
     return (C *) ptr;
   }
 
@@ -198,7 +198,7 @@ public:
         for (unsigned int i = 0; i < RND16(sizeof(C)) / sizeof(int64_t); i++)
           ((int64_t *) ptr)[i] = ((int64_t *) &this->proto.typeObject)[i];
       } else
-        memcpy(ptr, &this->proto.typeObject, sizeof(C));
+        memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
     } else
       (*_instantiate) ((C *) &this->proto.typeObject, (C *) ptr);
     return (C *) ptr;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/IpMap.cc
----------------------------------------------------------------------
diff --git a/lib/ts/IpMap.cc b/lib/ts/IpMap.cc
index e1ec0c4..564926d 100644
--- a/lib/ts/IpMap.cc
+++ b/lib/ts/IpMap.cc
@@ -900,7 +900,7 @@ typedef Interval<in_addr_t, in_addr_t> Ip4Span;
     for API compliance (which requires @c sockaddr* access).
 */
 class Ip4Node : public IpMap::Node, protected Ip4Span {
-  friend class IpMapBase<Ip4Node>;
+  friend struct IpMapBase<Ip4Node>;
 public:
   typedef Ip4Node self; ///< Self reference type.
 
@@ -1020,7 +1020,7 @@ typedef Interval<sockaddr_in6> Ip6Span;
 /** Node for IPv6 map.
 */
 class Ip6Node : public IpMap::Node, protected Ip6Span {
-  friend class IpMapBase<Ip6Node>;
+  friend struct IpMapBase<Ip6Node>;
 public:
   typedef Ip6Node self; ///< Self reference type.
   /// Override @c ArgType from @c Interval because the convention

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_atomic.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_atomic.h b/lib/ts/ink_atomic.h
index 5853e19..3e358c6 100644
--- a/lib/ts/ink_atomic.h
+++ b/lib/ts/ink_atomic.h
@@ -113,7 +113,7 @@ static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { return _
 static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
 
 static inline int ink_atomic_increment(pvint32 mem, int value) { return __sync_fetch_and_add(mem, value); }
-static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { return __sync_fetch_and_add((void**)mem, value); }
+static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { return __sync_fetch_and_add((void**)mem, (void*)value); }
 
 // Special hacks for ARM 32-bit
 #if defined(__arm__) && (SIZEOF_VOIDP == 4)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_auth_api.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_auth_api.cc b/lib/ts/ink_auth_api.cc
index 4926ddc..be82c46 100644
--- a/lib/ts/ink_auth_api.cc
+++ b/lib/ts/ink_auth_api.cc
@@ -27,7 +27,7 @@
 #include "ink_code.h"
 #include "ink_auth_api.h"
 
-static int s_rand_seed = time(NULL) + s_rand_seed;
+static int s_rand_seed = time(NULL); // + s_rand_seed;
 static InkRand
 s_rand_gen(ink_rand_r((unsigned int *) &s_rand_seed) ^ (uintptr_t) &s_rand_seed);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_inet.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_inet.h b/lib/ts/ink_inet.h
index 759594b..1f954fd 100644
--- a/lib/ts/ink_inet.h
+++ b/lib/ts/ink_inet.h
@@ -45,7 +45,7 @@ static inline bool IN6_IS_ADDR_UNSPECIFIED(in6_addr const* addr) {
 }
 #endif
 
-class InkInetAddr; // forward declare.
+struct InkInetAddr; // forward declare.
 
 /** A union to hold the standard IP address structures.
     By standard we mean @c sockaddr compliant.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/proxy/ControlMatcher.cc
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc
index df7e41b..b181b76 100644
--- a/proxy/ControlMatcher.cc
+++ b/proxy/ControlMatcher.cc
@@ -541,7 +541,7 @@ template<class Data, class Result>
 
 template<class Data, class Result> void IpMatcher<Data, Result>::Print()
 {
-  printf("\tIp Matcher with %d elements, %Zu ranges.\n", num_el, ip_map.getCount());
+  printf("\tIp Matcher with %d elements, %zu ranges.\n", num_el, ip_map.getCount());
   for ( IpMap::iterator spot(ip_map.begin()), limit(ip_map.end()) ; spot != limit ; ++spot) {
     char b1[INET6_ADDRSTRLEN], b2[INET6_ADDRSTRLEN];
     printf("\tRange %s - %s ",

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index bdfa0b8..5ebd987 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -762,6 +762,8 @@ REGRESSION_TEST(SDK_API_TSCache) (RegressionTest * test, int atype, int *pstatus
   TSCacheKeyDigestSet(key, key_name, strlen(key_name));
   TSCacheKeyDigestSet(key_cmp, key_name, strlen(key_name));
 
+  // TODO: This comparison makes no sense, since TSCacheKey is an opaque struct
+#if 0
   if (memcmp(key, key_cmp, sizeof(TSCacheKey)) != 0) {
     SDK_RPRINT(test, "TSCacheKeySetDigest", "TestCase1", TC_FAIL, "digest is wrong");
 
@@ -774,6 +776,7 @@ REGRESSION_TEST(SDK_API_TSCache) (RegressionTest * test, int atype, int *pstatus
     SDK_RPRINT(test, "TSCacheKeySetDigest", "TestCase1", TC_PASS, "ok");
     TSCacheKeyDestroy(key_cmp);
   }
+#endif
 
   // prepare caching content
   // string, null-terminated.
@@ -5131,7 +5134,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) (RegressionTest * test, int atype, int *
           SDK_RPRINT(test, "TSMimeHdrFieldRemove", "TestCase1", TC_FAIL, "Field Not Removed");
         }
 
-        if ((test_passed_mime_hdr_field_remove == true)) {
+        if (test_passed_mime_hdr_field_remove == true) {
           if (TSMimeHdrFieldAppend(bufp2, mime_hdr_loc2, field_loc1) != TS_SUCCESS) {
             SDK_RPRINT(test, "TSMimeHdrFieldRemove", "TestCase1", TC_FAIL,
                        "Unable to readd the field to mime header. Probably destroyed");


Re: git commit: TS-1116 Some fixes for clang/llvm, on OSX

Posted by Leif Hedstrom <zw...@apache.org>.
On 2/21/12 5:15 AM, Igor Galić wrote:
>
> +  // TODO: This comparison makes no sense, since TSCacheKey is an
> opaque struct
> +#if 0
> Is this commit the right place to #if 0 this code?
> Does that have any side effects?
>
>

Unless I'm mistaken, it's a non-sensical regression test, which is 
testing something no one should do. And it doesn't compile on Clang (and 
rightly so if I'm correct).

-- leif



Re: git commit: TS-1116 Some fixes for clang/llvm, on OSX

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Updated Branches:
>   refs/heads/master ef63f9f68 -> 19f367381
> 
> 
> TS-1116 Some fixes for clang/llvm, on OSX
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/trafficserver/commit/19f36738
> Tree:
> http://git-wip-us.apache.org/repos/asf/trafficserver/tree/19f36738
> Diff:
> http://git-wip-us.apache.org/repos/asf/trafficserver/diff/19f36738
> 
> Branch: refs/heads/master
> Commit: 19f3673812d38704d9387dbbffc4c82b4c275f37
> Parents: ef63f9f
> Author: Leif Hedstrom <zw...@apache.org>
> Authored: Sat Feb 18 21:35:23 2012 -0700
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Sat Feb 18 21:35:23 2012 -0700
> 
> ----------------------------------------------------------------------
>  iocore/cache/CacheHosting.cc |    4 ++--
>  lib/ts/Allocator.h           |    4 ++--
>  lib/ts/IpMap.cc              |    4 ++--
>  lib/ts/ink_atomic.h          |    2 +-
>  lib/ts/ink_auth_api.cc       |    2 +-
>  lib/ts/ink_inet.h            |    2 +-
>  proxy/ControlMatcher.cc      |    2 +-
>  proxy/InkAPITest.cc          |    5 ++++-
>  8 files changed, 14 insertions(+), 11 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/iocore/cache/CacheHosting.cc
> ----------------------------------------------------------------------
> diff --git a/iocore/cache/CacheHosting.cc
> b/iocore/cache/CacheHosting.cc
> index c9d316f..f1b32cc 100644
> --- a/iocore/cache/CacheHosting.cc
> +++ b/iocore/cache/CacheHosting.cc
> @@ -512,7 +512,7 @@ CacheHostRecord::Init(matcher_line * line_info,
> int typ)
>  
>        /* first find out the number of volumes */
>        while (*s) {
> -        if ((*s == ',')) {
> +        if (*s == ',') {
>            num_cachevols++;
>            s++;
>            if (!(*s)) {
> @@ -554,7 +554,7 @@ CacheHostRecord::Init(matcher_line * line_info,
> int typ)
>            for (; cachep; cachep = cachep->link.next) {
>              if (cachep->vol_number == volume_number) {
>                is_vol_present = 1;
> -              if ((cachep->scheme == type)) {
> +              if (cachep->scheme == type) {
>                  Debug("cache_hosting",
>                        "Host Record: %p, Volume: %d, size: %ld",
>                        this, volume_number, (long)(cachep->size *
>                        STORE_BLOCK_SIZE));
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/Allocator.h
> ----------------------------------------------------------------------
> diff --git a/lib/ts/Allocator.h b/lib/ts/Allocator.h
> index beb7153..5ee62ce 100644
> --- a/lib/ts/Allocator.h
> +++ b/lib/ts/Allocator.h
> @@ -118,7 +118,7 @@ public:
>        for (unsigned int i = 0; i < RND16(sizeof(C)) /
>        sizeof(int64_t); i++)
>          ((int64_t *) ptr)[i] = ((int64_t *)
>          &this->proto.typeObject)[i];
>      } else
> -      memcpy(ptr, &this->proto.typeObject, sizeof(C));
> +      memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
>      return (C *) ptr;
>    }
>  
> @@ -198,7 +198,7 @@ public:
>          for (unsigned int i = 0; i < RND16(sizeof(C)) /
>          sizeof(int64_t); i++)
>            ((int64_t *) ptr)[i] = ((int64_t *)
>            &this->proto.typeObject)[i];
>        } else
> -        memcpy(ptr, &this->proto.typeObject, sizeof(C));
> +        memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
>      } else
>        (*_instantiate) ((C *) &this->proto.typeObject, (C *) ptr);
>      return (C *) ptr;
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/IpMap.cc
> ----------------------------------------------------------------------
> diff --git a/lib/ts/IpMap.cc b/lib/ts/IpMap.cc
> index e1ec0c4..564926d 100644
> --- a/lib/ts/IpMap.cc
> +++ b/lib/ts/IpMap.cc
> @@ -900,7 +900,7 @@ typedef Interval<in_addr_t, in_addr_t> Ip4Span;
>      for API compliance (which requires @c sockaddr* access).
>  */
>  class Ip4Node : public IpMap::Node, protected Ip4Span {
> -  friend class IpMapBase<Ip4Node>;
> +  friend struct IpMapBase<Ip4Node>;
>  public:
>    typedef Ip4Node self; ///< Self reference type.
>  
> @@ -1020,7 +1020,7 @@ typedef Interval<sockaddr_in6> Ip6Span;
>  /** Node for IPv6 map.
>  */
>  class Ip6Node : public IpMap::Node, protected Ip6Span {
> -  friend class IpMapBase<Ip6Node>;
> +  friend struct IpMapBase<Ip6Node>;
>  public:
>    typedef Ip6Node self; ///< Self reference type.
>    /// Override @c ArgType from @c Interval because the convention
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_atomic.h
> ----------------------------------------------------------------------
> diff --git a/lib/ts/ink_atomic.h b/lib/ts/ink_atomic.h
> index 5853e19..3e358c6 100644
> --- a/lib/ts/ink_atomic.h
> +++ b/lib/ts/ink_atomic.h
> @@ -113,7 +113,7 @@ static inline int ink_atomic_cas(pvint32 mem, int
> old, int new_value) { return _
>  static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void*
>  new_value) { return __sync_bool_compare_and_swap(mem, old,
>  new_value); }
>  
>  static inline int ink_atomic_increment(pvint32 mem, int value) {
>  return __sync_fetch_and_add(mem, value); }
> -static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t
> value) { return __sync_fetch_and_add((void**)mem, value); }
> +static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t
> value) { return __sync_fetch_and_add((void**)mem, (void*)value); }
>  
>  // Special hacks for ARM 32-bit
>  #if defined(__arm__) && (SIZEOF_VOIDP == 4)
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_auth_api.cc
> ----------------------------------------------------------------------
> diff --git a/lib/ts/ink_auth_api.cc b/lib/ts/ink_auth_api.cc
> index 4926ddc..be82c46 100644
> --- a/lib/ts/ink_auth_api.cc
> +++ b/lib/ts/ink_auth_api.cc
> @@ -27,7 +27,7 @@
>  #include "ink_code.h"
>  #include "ink_auth_api.h"
>  
> -static int s_rand_seed = time(NULL) + s_rand_seed;
> +static int s_rand_seed = time(NULL); // + s_rand_seed;
>  static InkRand
>  s_rand_gen(ink_rand_r((unsigned int *) &s_rand_seed) ^ (uintptr_t)
>  &s_rand_seed);
>  
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/lib/ts/ink_inet.h
> ----------------------------------------------------------------------
> diff --git a/lib/ts/ink_inet.h b/lib/ts/ink_inet.h
> index 759594b..1f954fd 100644
> --- a/lib/ts/ink_inet.h
> +++ b/lib/ts/ink_inet.h
> @@ -45,7 +45,7 @@ static inline bool IN6_IS_ADDR_UNSPECIFIED(in6_addr
> const* addr) {
>  }
>  #endif
>  
> -class InkInetAddr; // forward declare.
> +struct InkInetAddr; // forward declare.
>  
>  /** A union to hold the standard IP address structures.
>      By standard we mean @c sockaddr compliant.
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/proxy/ControlMatcher.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc
> index df7e41b..b181b76 100644
> --- a/proxy/ControlMatcher.cc
> +++ b/proxy/ControlMatcher.cc
> @@ -541,7 +541,7 @@ template<class Data, class Result>
>  
>  template<class Data, class Result> void IpMatcher<Data,
>  Result>::Print()
>  {
> -  printf("\tIp Matcher with %d elements, %Zu ranges.\n", num_el,
> ip_map.getCount());
> +  printf("\tIp Matcher with %d elements, %zu ranges.\n", num_el,
> ip_map.getCount());
>    for ( IpMap::iterator spot(ip_map.begin()), limit(ip_map.end()) ;
>    spot != limit ; ++spot) {
>      char b1[INET6_ADDRSTRLEN], b2[INET6_ADDRSTRLEN];
>      printf("\tRange %s - %s ",
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19f36738/proxy/InkAPITest.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
> index bdfa0b8..5ebd987 100644
> --- a/proxy/InkAPITest.cc
> +++ b/proxy/InkAPITest.cc
> @@ -762,6 +762,8 @@ REGRESSION_TEST(SDK_API_TSCache) (RegressionTest
> * test, int atype, int *pstatus
>    TSCacheKeyDigestSet(key, key_name, strlen(key_name));
>    TSCacheKeyDigestSet(key_cmp, key_name, strlen(key_name));
>  
> +  // TODO: This comparison makes no sense, since TSCacheKey is an
> opaque struct
> +#if 0

Is this commit the right place to #if 0 this code?
Does that have any side effects?

>    if (memcmp(key, key_cmp, sizeof(TSCacheKey)) != 0) {
>      SDK_RPRINT(test, "TSCacheKeySetDigest", "TestCase1", TC_FAIL,
>      "digest is wrong");
>  
> @@ -774,6 +776,7 @@ REGRESSION_TEST(SDK_API_TSCache) (RegressionTest
> * test, int atype, int *pstatus
>      SDK_RPRINT(test, "TSCacheKeySetDigest", "TestCase1", TC_PASS,
>      "ok");
>      TSCacheKeyDestroy(key_cmp);
>    }
> +#endif
>  
>    // prepare caching content
>    // string, null-terminated.
> @@ -5131,7 +5134,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse)
> (RegressionTest * test, int atype, int *
>            SDK_RPRINT(test, "TSMimeHdrFieldRemove", "TestCase1",
>            TC_FAIL, "Field Not Removed");
>          }
>  
> -        if ((test_passed_mime_hdr_field_remove == true)) {
> +        if (test_passed_mime_hdr_field_remove == true) {
>            if (TSMimeHdrFieldAppend(bufp2, mime_hdr_loc2, field_loc1)
>            != TS_SUCCESS) {
>              SDK_RPRINT(test, "TSMimeHdrFieldRemove", "TestCase1",
>              TC_FAIL,
>                         "Unable to readd the field to mime header.
>                         Probably destroyed");
> 
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE