aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2020-07-02 01:24:39 +0200
committerMike Pall <mike>2020-07-02 01:24:39 +0200
commit384d6d56f4a3841fdef607a511dda92a579af2ff (patch)
treea95ad69b90ca9598141140de91850bf1d9677c1d
parent18eef08fb8df11dd887b1e7e3e6f7919c6f56720 (diff)
downloadluajit-384d6d56f4a3841fdef607a511dda92a579af2ff.tar.gz
luajit-384d6d56f4a3841fdef607a511dda92a579af2ff.tar.bz2
luajit-384d6d56f4a3841fdef607a511dda92a579af2ff.zip
Fix Clang build.
-rw-r--r--src/lj_alloc.c2
-rw-r--r--src/lj_def.h4
-rw-r--r--src/lj_emit_x86.h2
-rw-r--r--src/lj_err.c4
-rw-r--r--src/lj_ircall.h2
-rw-r--r--src/lj_mcode.c2
-rw-r--r--src/lj_strfmt.h2
-rw-r--r--src/lj_strscan.c2
8 files changed, 10 insertions, 10 deletions
diff --git a/src/lj_alloc.c b/src/lj_alloc.c
index 2d41481d..5de60b82 100644
--- a/src/lj_alloc.c
+++ b/src/lj_alloc.c
@@ -597,7 +597,7 @@ static int has_segment_link(mstate m, msegmentptr ss)
597 noncontiguous segments are added. 597 noncontiguous segments are added.
598*/ 598*/
599#define TOP_FOOT_SIZE\ 599#define TOP_FOOT_SIZE\
600 (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) 600 (align_offset(TWO_SIZE_T_SIZES)+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
601 601
602/* ---------------------------- Indexing Bins ---------------------------- */ 602/* ---------------------------- Indexing Bins ---------------------------- */
603 603
diff --git a/src/lj_def.h b/src/lj_def.h
index 5e63da3e..cfe18c48 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -120,7 +120,7 @@ typedef uintptr_t BloomFilter;
120#define bloomset(b, x) ((b) |= bloombit((x))) 120#define bloomset(b, x) ((b) |= bloombit((x)))
121#define bloomtest(b, x) ((b) & bloombit((x))) 121#define bloomtest(b, x) ((b) & bloombit((x)))
122 122
123#if defined(__GNUC__) || defined(__psp2__) 123#if defined(__GNUC__) || defined(__clang__) || defined(__psp2__)
124 124
125#define LJ_NORET __attribute__((noreturn)) 125#define LJ_NORET __attribute__((noreturn))
126#define LJ_ALIGN(n) __attribute__((aligned(n))) 126#define LJ_ALIGN(n) __attribute__((aligned(n)))
@@ -182,7 +182,7 @@ static LJ_AINLINE uint64_t lj_bswap64(uint64_t x)
182{ 182{
183 return ((uint64_t)lj_bswap((uint32_t)x)<<32) | lj_bswap((uint32_t)(x>>32)); 183 return ((uint64_t)lj_bswap((uint32_t)x)<<32) | lj_bswap((uint32_t)(x>>32));
184} 184}
185#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 185#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __clang__
186static LJ_AINLINE uint32_t lj_bswap(uint32_t x) 186static LJ_AINLINE uint32_t lj_bswap(uint32_t x)
187{ 187{
188 return (uint32_t)__builtin_bswap32((int32_t)x); 188 return (uint32_t)__builtin_bswap32((int32_t)x);
diff --git a/src/lj_emit_x86.h b/src/lj_emit_x86.h
index 66750a96..9173a299 100644
--- a/src/lj_emit_x86.h
+++ b/src/lj_emit_x86.h
@@ -45,7 +45,7 @@ static LJ_AINLINE MCode *emit_op(x86Op xo, Reg rr, Reg rb, Reg rx,
45 *(uint32_t *)(p+delta-5) = (uint32_t)xo; 45 *(uint32_t *)(p+delta-5) = (uint32_t)xo;
46 return p+delta-5; 46 return p+delta-5;
47 } 47 }
48#if defined(__GNUC__) 48#if defined(__GNUC__) || defined(__clang__)
49 if (__builtin_constant_p(xo) && n == -2) 49 if (__builtin_constant_p(xo) && n == -2)
50 p[delta-2] = (MCode)(xo >> 24); 50 p[delta-2] = (MCode)(xo >> 24);
51 else if (__builtin_constant_p(xo) && n == -3) 51 else if (__builtin_constant_p(xo) && n == -3)
diff --git a/src/lj_err.c b/src/lj_err.c
index 41fbf5c7..39339b10 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -61,7 +61,7 @@
61** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4). 61** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4).
62*/ 62*/
63 63
64#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND 64#if (defined(__GNUC__) || defined(__clang__)) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND
65#define LJ_UNWIND_EXT 1 65#define LJ_UNWIND_EXT 1
66#elif LJ_TARGET_WINDOWS 66#elif LJ_TARGET_WINDOWS
67#define LJ_UNWIND_EXT 1 67#define LJ_UNWIND_EXT 1
@@ -184,7 +184,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
184 184
185/* -- External frame unwinding -------------------------------------------- */ 185/* -- External frame unwinding -------------------------------------------- */
186 186
187#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_ABI_WIN 187#if (defined(__GNUC__) || defined(__clang__)) && !LJ_NO_UNWIND && !LJ_ABI_WIN
188 188
189/* 189/*
190** We have to use our own definitions instead of the mandatory (!) unwind.h, 190** We have to use our own definitions instead of the mandatory (!) unwind.h,
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
index 58cebc5d..a45dde34 100644
--- a/src/lj_ircall.h
+++ b/src/lj_ircall.h
@@ -334,7 +334,7 @@ extern double lj_vm_sfmax(double a, double b);
334#endif 334#endif
335 335
336#if LJ_HASFFI && LJ_NEED_FP64 && !(LJ_TARGET_ARM && LJ_SOFTFP) 336#if LJ_HASFFI && LJ_NEED_FP64 && !(LJ_TARGET_ARM && LJ_SOFTFP)
337#ifdef __GNUC__ 337#if defined(__GNUC__) || defined(__clang__)
338#define fp64_l2d __floatdidf 338#define fp64_l2d __floatdidf
339#define fp64_ul2d __floatundidf 339#define fp64_ul2d __floatundidf
340#define fp64_l2f __floatdisf 340#define fp64_l2f __floatdisf
diff --git a/src/lj_mcode.c b/src/lj_mcode.c
index b2d12118..a5153b25 100644
--- a/src/lj_mcode.c
+++ b/src/lj_mcode.c
@@ -45,7 +45,7 @@ void lj_mcode_sync(void *start, void *end)
45 sys_icache_invalidate(start, (char *)end-(char *)start); 45 sys_icache_invalidate(start, (char *)end-(char *)start);
46#elif LJ_TARGET_PPC 46#elif LJ_TARGET_PPC
47 lj_vm_cachesync(start, end); 47 lj_vm_cachesync(start, end);
48#elif defined(__GNUC__) 48#elif defined(__GNUC__) || defined(__clang__)
49 __clear_cache(start, end); 49 __clear_cache(start, end);
50#else 50#else
51#error "Missing builtin to flush instruction cache" 51#error "Missing builtin to flush instruction cache"
diff --git a/src/lj_strfmt.h b/src/lj_strfmt.h
index b4fbbb94..9fe46d67 100644
--- a/src/lj_strfmt.h
+++ b/src/lj_strfmt.h
@@ -118,7 +118,7 @@ LJ_FUNC GCstr * LJ_FASTCALL lj_strfmt_obj(lua_State *L, cTValue *o);
118LJ_FUNC const char *lj_strfmt_pushvf(lua_State *L, const char *fmt, 118LJ_FUNC const char *lj_strfmt_pushvf(lua_State *L, const char *fmt,
119 va_list argp); 119 va_list argp);
120LJ_FUNC const char *lj_strfmt_pushf(lua_State *L, const char *fmt, ...) 120LJ_FUNC const char *lj_strfmt_pushf(lua_State *L, const char *fmt, ...)
121#ifdef __GNUC__ 121#if defined(__GNUC__) || defined(__clang__)
122 __attribute__ ((format (printf, 2, 3))) 122 __attribute__ ((format (printf, 2, 3)))
123#endif 123#endif
124 ; 124 ;
diff --git a/src/lj_strscan.c b/src/lj_strscan.c
index 0e37a4f6..11abd526 100644
--- a/src/lj_strscan.c
+++ b/src/lj_strscan.c
@@ -79,7 +79,7 @@ static void strscan_double(uint64_t x, TValue *o, int32_t ex2, int32_t neg)
79 /* Avoid double rounding for denormals. */ 79 /* Avoid double rounding for denormals. */
80 if (LJ_UNLIKELY(ex2 <= -1075 && x != 0)) { 80 if (LJ_UNLIKELY(ex2 <= -1075 && x != 0)) {
81 /* NYI: all of this generates way too much code on 32 bit CPUs. */ 81 /* NYI: all of this generates way too much code on 32 bit CPUs. */
82#if defined(__GNUC__) && LJ_64 82#if (defined(__GNUC__) || defined(__clang__)) && LJ_64
83 int32_t b = (int32_t)(__builtin_clzll(x)^63); 83 int32_t b = (int32_t)(__builtin_clzll(x)^63);
84#else 84#else
85 int32_t b = (x>>32) ? 32+(int32_t)lj_fls((uint32_t)(x>>32)) : 85 int32_t b = (x>>32) ? 32+(int32_t)lj_fls((uint32_t)(x>>32)) :