Skip to content

Commit

Permalink
[compiler-rt] Fix a warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kazutakahirata committed Oct 21, 2023
1 parent a3937c4 commit d36ddaa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions compiler-rt/lib/builtins/int_to_fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d36ddaa

Please sign in to comment.