[compiler-rt] dd2be15 - [gcov] Silence warning: comparison of integers of different signs

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Tue May 25 15:46:46 PDT 2021


Author: Alexandre Ganea
Date: 2021-05-25T18:46:37-04:00
New Revision: dd2be15ff91a9a93387afbe0789f4de3376c0c0f

URL: https://github.com/llvm/llvm-project/commit/dd2be15ff91a9a93387afbe0789f4de3376c0c0f
DIFF: https://github.com/llvm/llvm-project/commit/dd2be15ff91a9a93387afbe0789f4de3376c0c0f.diff

LOG: [gcov] Silence warning: comparison of integers of different signs

When building with Clang 11 on Windows, silence the following:

[432/5643] Building C object projects\compiler-rt\lib\profile\CMakeFiles\clang_rt.profile-x86_64.dir\GCDAProfiling.c.obj
F:\aganea\llvm-project\compiler-rt\lib\profile\GCDAProfiling.c(464,13): warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
    if (val != (gcov_version >= 90 ? GCOV_TAG_OBJECT_SUMMARY
        ~~~ ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Added: 
    

Modified: 
    compiler-rt/lib/profile/GCDAProfiling.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index 649c73f9d3612..8e51f57b09ffb 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -461,8 +461,9 @@ void llvm_gcda_summary_info() {
 
   if (val != (uint32_t)-1) {
     /* There are counters present in the file. Merge them. */
-    if (val != (gcov_version >= 90 ? GCOV_TAG_OBJECT_SUMMARY
-                                   : GCOV_TAG_PROGRAM_SUMMARY)) {
+    uint32_t gcov_tag =
+        gcov_version >= 90 ? GCOV_TAG_OBJECT_SUMMARY : GCOV_TAG_PROGRAM_SUMMARY;
+    if (val != gcov_tag) {
       fprintf(stderr,
               "profiling: %s: cannot merge previous run count: "
               "corrupt object tag (0x%08x)\n",


        


More information about the llvm-commits mailing list