[compiler-rt] d36ddaa - [compiler-rt] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 23:04:02 PDT 2023


Author: Kazu Hirata
Date: 2023-10-20T23:03:55-07:00
New Revision: d36ddaa665823de9e922923b0d2b7fd254759816

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

LOG: [compiler-rt] Fix a warning

This patch fixes:

  compiler-rt/lib/builtins/int_to_fp_impl.inc:22:18: error: expression
  is not an integer constant expression; folding it to a constant is a
  GNU extension [-Werror,-Wgnu-folding-constant]

by using enum for constants.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/int_to_fp.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/int_to_fp.h b/compiler-rt/lib/builtins/int_to_fp.h
index cbce49eed140c4c..9e56a1469679ec0 100644
--- a/compiler-rt/lib/builtins/int_to_fp.h
+++ b/compiler-rt/lib/builtins/int_to_fp.h
@@ -53,13 +53,19 @@ enum {
 typedef double dst_t;
 typedef uint64_t dst_rep_t;
 #define DST_REP_C UINT64_C
-static const int dstSigBits = 52;
+
+enum {
+  dstSigBits = 52,
+};
 
 #elif defined DST_QUAD
 typedef long double dst_t;
 typedef __uint128_t dst_rep_t;
 #define DST_REP_C (__uint128_t)
-static const int dstSigBits = 112;
+
+enum {
+  dstSigBits = 112,
+};
 
 #else
 #error Destination should be a handled floating point type


        


More information about the llvm-commits mailing list