Skip to content

Commit 3713664

Browse files
committed
llvm: TargetLibraryInfo: Undefine libc functions if they are macros
musl defines some functions as macros and not inline functions if this is the case then make sure to undefine them Upstream-Status: Pending Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 parent 9d36ccd commit 3713664

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

llvm/include/llvm/Analysis/TargetLibraryInfo.def

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,9 @@ TLI_DEFINE_STRING_INTERNAL("fopen")
14671467
TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
14681468

14691469
/// FILE *fopen64(const char *filename, const char *opentype)
1470+
#ifdef fopen64
1471+
#undef fopen64
1472+
#endif
14701473
TLI_DEFINE_ENUM_INTERNAL(fopen64)
14711474
TLI_DEFINE_STRING_INTERNAL("fopen64")
14721475
TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
@@ -1545,7 +1548,9 @@ TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Long, Int)
15451548
TLI_DEFINE_ENUM_INTERNAL(fseeko)
15461549
TLI_DEFINE_STRING_INTERNAL("fseeko")
15471550
TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, Int)
1548-
1551+
#ifdef fseeko64
1552+
#undef fseeko64
1553+
#endif
15491554
/// int fseeko64(FILE *stream, off64_t offset, int whence)
15501555
TLI_DEFINE_ENUM_INTERNAL(fseeko64)
15511556
TLI_DEFINE_STRING_INTERNAL("fseeko64")
@@ -1562,6 +1567,9 @@ TLI_DEFINE_STRING_INTERNAL("fstat")
15621567
TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
15631568

15641569
/// int fstat64(int filedes, struct stat64 *buf)
1570+
#ifdef fstat64
1571+
#undef fstat64
1572+
#endif
15651573
TLI_DEFINE_ENUM_INTERNAL(fstat64)
15661574
TLI_DEFINE_STRING_INTERNAL("fstat64")
15671575
TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
@@ -1587,6 +1595,9 @@ TLI_DEFINE_STRING_INTERNAL("ftello")
15871595
TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
15881596

15891597
/// off64_t ftello64(FILE *stream)
1598+
#ifdef ftello64
1599+
#undef ftello64
1600+
#endif
15901601
TLI_DEFINE_ENUM_INTERNAL(ftello64)
15911602
TLI_DEFINE_STRING_INTERNAL("ftello64")
15921603
TLI_DEFINE_SIG_INTERNAL(Int64, Ptr)
@@ -1827,6 +1838,9 @@ TLI_DEFINE_STRING_INTERNAL("lstat")
18271838
TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
18281839

18291840
/// int lstat64(const char *path, struct stat64 *buf);
1841+
#ifdef lstat64
1842+
#undef lstat64
1843+
#endif
18301844
TLI_DEFINE_ENUM_INTERNAL(lstat64)
18311845
TLI_DEFINE_STRING_INTERNAL("lstat64")
18321846
TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
@@ -2334,6 +2348,9 @@ TLI_DEFINE_STRING_INTERNAL("stat")
23342348
TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
23352349

23362350
/// int stat64(const char *path, struct stat64 *buf);
2351+
#ifdef stat64
2352+
#undef stat64
2353+
#endif
23372354
TLI_DEFINE_ENUM_INTERNAL(stat64)
23382355
TLI_DEFINE_STRING_INTERNAL("stat64")
23392356
TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
@@ -2559,6 +2576,9 @@ TLI_DEFINE_STRING_INTERNAL("tmpfile")
25592576
TLI_DEFINE_SIG_INTERNAL(Ptr)
25602577

25612578
/// FILE *tmpfile64(void)
2579+
#ifdef tmpfile64
2580+
#undef tmpfile64
2581+
#endif
25622582
TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
25632583
TLI_DEFINE_STRING_INTERNAL("tmpfile64")
25642584
TLI_DEFINE_SIG_INTERNAL(Ptr)

0 commit comments

Comments
 (0)