[llvm-commits] [compiler-rt] r163788 - in /compiler-rt/trunk/lib/tsan/rtl: tsan_interceptors.cc tsan_interface_atomic.h tsan_mman.h tsan_mutex.cc tsan_mutex.h tsan_platform_linux.cc tsan_report.h tsan_rtl.h tsan_rtl_report.cc tsan_stat.h tsan_sup

Kostya Serebryany kcc at google.com
Thu Sep 13 05:10:48 PDT 2012


On Thu, Sep 13, 2012 at 3:54 PM, Alexey Samsonov <samsonov at google.com>wrote:

> Author: samsonov
> Date: Thu Sep 13 06:54:41 2012
> New Revision: 163788
>
> URL: http://llvm.org/viewvc/llvm-project?rev=163788&view=rev
> Log:
> [TSan] fix a bunch of warnings reported by pedantic gcc
>
> Modified:
>     compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_mman.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_trace.h
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Thu Sep 13
> 06:54:41 2012
> @@ -1366,11 +1366,11 @@
>  }
>
>  TSAN_INTERCEPTOR(sighandler_t, signal, int sig, sighandler_t h) {
> -  sigaction_t act = {};
> +  sigaction_t act;
>    act.sa_handler = h;
>    REAL(memset)(&act.sa_mask, -1, sizeof(act.sa_mask));
>    act.sa_flags = 0;
> -  sigaction_t old = {};
> +  sigaction_t old;
>    int res = sigaction(sig, &act, &old);
>    if (res)
>      return SIG_ERR;
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h Thu Sep 13
> 06:54:41 2012
> @@ -28,7 +28,7 @@
>    __tsan_memory_order_acquire = 1 << 2,
>    __tsan_memory_order_release = 1 << 3,
>    __tsan_memory_order_acq_rel = 1 << 4,
> -  __tsan_memory_order_seq_cst = 1 << 5,
> +  __tsan_memory_order_seq_cst = 1 << 5
>  } __tsan_memory_order;
>


I don' like this warning.
Adding a comma after the last element of such a list is a very nice
feature.
What do others think?



>
>  __tsan_atomic8 __tsan_atomic8_load(const volatile __tsan_atomic8 *a,
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mman.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_mman.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_mman.h Thu Sep 13 06:54:41 2012
> @@ -57,7 +57,7 @@
>    MBlockSignal,
>
>    // This must be the last.
> -  MBlockTypeCount,
> +  MBlockTypeCount
>  };
>
>  // For internal data structures.
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc Thu Sep 13 06:54:41 2012
> @@ -48,7 +48,7 @@
>    bool leaf[N] = {};
>    for (int i = 1; i < N; i++) {
>      for (int j = 0; j < N; j++) {
> -      int z = CanLockTab[i][j];
> +      MutexType z = CanLockTab[i][j];
>        if (z == MutexTypeInvalid)
>          continue;
>        if (z == MutexTypeLeaf) {
> @@ -56,8 +56,8 @@
>          leaf[i] = true;
>          continue;
>        }
> -      CHECK(!CanLockAdj[i][z]);
> -      CanLockAdj[i][z] = true;
> +      CHECK(!CanLockAdj[i][(int)z]);
> +      CanLockAdj[i][(int)z] = true;
>        cnt[i]++;
>      }
>    }
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.h Thu Sep 13 06:54:41 2012
> @@ -31,7 +31,7 @@
>    MutexTypeAtExit,
>
>    // This must be the last.
> -  MutexTypeCount,
> +  MutexTypeCount
>  };
>
>  class Mutex {
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Thu Sep 13
> 06:54:41 2012
> @@ -178,8 +178,12 @@
>  static int InitTlsSize() {
>    typedef void (*get_tls_func)(size_t*, size_t*) INTERNAL_FUNCTION;
>    get_tls_func get_tls = &_dl_get_tls_static_info;
> -  if (get_tls == 0)
> -    get_tls = (get_tls_func)dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
> +  if (get_tls == 0) {
> +    void *get_tls_static_info_ptr = dlsym(RTLD_NEXT,
> "_dl_get_tls_static_info");
> +    CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
> +    internal_memcpy(&get_tls, &get_tls_static_info_ptr,
> +                    sizeof(get_tls_static_info_ptr));
> +  }
>    CHECK_NE(get_tls, 0);
>    size_t tls_size = 0;
>    size_t tls_align = 0;
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_report.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.h Thu Sep 13 06:54:41 2012
> @@ -24,7 +24,7 @@
>    ReportTypeThreadLeak,
>    ReportTypeMutexDestroyLocked,
>    ReportTypeSignalUnsafe,
> -  ReportTypeErrnoInSignal,
> +  ReportTypeErrnoInSignal
>  };
>
>  struct ReportStack {
> @@ -51,7 +51,7 @@
>  enum ReportLocationType {
>    ReportLocationGlobal,
>    ReportLocationHeap,
> -  ReportLocationStack,
> +  ReportLocationStack
>  };
>
>  struct ReportLocation {
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Thu Sep 13 06:54:41 2012
> @@ -316,7 +316,7 @@
>    ThreadStatusCreated,   // Created but not yet running.
>    ThreadStatusRunning,   // The thread is currently running.
>    ThreadStatusFinished,  // Joinable thread is finished but not yet
> joined.
> -  ThreadStatusDead,      // Joined, but some info (trace) is still alive.
> +  ThreadStatusDead       // Joined, but some info (trace) is still alive.
>  };
>
>  // An info about a thread that is hold for some time after its
> termination.
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Thu Sep 13 06:54:41
> 2012
> @@ -301,7 +301,7 @@
>      uptr addr_min, uptr addr_max) {
>    Context *ctx = CTX();
>    bool equal_stack = false;
> -  RacyStacks hash = {};
> +  RacyStacks hash;
>    if (flags()->suppress_equal_stacks) {
>      hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() *
> sizeof(uptr));
>      hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() *
> sizeof(uptr));
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h Thu Sep 13 06:54:41 2012
> @@ -250,7 +250,7 @@
>    StatMtxAtExit,
>
>    // This must be the last.
> -  StatCnt,
> +  StatCnt
>  };
>
>  }  // namespace __tsan
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h Thu Sep 13 06:54:41
> 2012
> @@ -26,7 +26,7 @@
>    SuppressionRace,
>    SuppressionMutex,
>    SuppressionThread,
> -  SuppressionSignal,
> +  SuppressionSignal
>  };
>
>  struct Suppression {
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_trace.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_trace.h?rev=163788&r1=163787&r2=163788&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_trace.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_trace.h Thu Sep 13 06:54:41 2012
> @@ -35,7 +35,7 @@
>    EventTypeLock,
>    EventTypeUnlock,
>    EventTypeRLock,
> -  EventTypeRUnlock,
> +  EventTypeRUnlock
>  };
>
>  // Represents a thread event (from most significant bit):
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120913/6a4d2915/attachment.html>


More information about the llvm-commits mailing list