Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-02-08 17:52:50 +0300
committerGuillaume Chatelet <gchatelet@google.com>2022-02-09 23:45:56 +0300
commitd2c595466207f5cc9b8cf01d66d3beaac134d02b (patch)
treed4f4a2acfc36def227e09ed144587ffd730154e7 /libc
parent6cd417bfd886ffe4e0cf4b48055aa7bfc352b789 (diff)
[libc] undefined reference in LibcTest.cpp
GCC complains about undefined reference in LibcTest.cpp and indeed the wrong version of the template has been explicitly instanciated. This is necessary to get llvm-libc compile with GCC. Mentionning D119002 here for navigability. Differential Revision: https://reviews.llvm.org/D119242
Diffstat (limited to 'libc')
-rw-r--r--libc/utils/UnitTest/LibcTest.cpp97
1 files changed, 49 insertions, 48 deletions
diff --git a/libc/utils/UnitTest/LibcTest.cpp b/libc/utils/UnitTest/LibcTest.cpp
index c998337039a6..ed3ca4173c61 100644
--- a/libc/utils/UnitTest/LibcTest.cpp
+++ b/libc/utils/UnitTest/LibcTest.cpp
@@ -195,69 +195,70 @@ int Test::runTests(const char *TestFilter) {
return FailCount > 0 || TestCount == 0 ? 1 : 0;
}
-template bool Test::test<char, 0>(TestCondition Cond, char LHS, char RHS,
+namespace internal {
+
+template bool test<char>(RunContext *Ctx, TestCondition Cond, char LHS,
+ char RHS, const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
+
+template bool test<short>(RunContext *Ctx, TestCondition Cond, short LHS,
+ short RHS, const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
+
+template bool test<int>(RunContext *Ctx, TestCondition Cond, int LHS, int RHS,
+ const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
+
+template bool test<long>(RunContext *Ctx, TestCondition Cond, long LHS,
+ long RHS, const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
+
+template bool test<long long>(RunContext *Ctx, TestCondition Cond,
+ long long LHS, long long RHS, const char *LHSStr,
+ const char *RHSStr, const char *File,
+ unsigned long Line);
+
+template bool test<__int128_t>(RunContext *Ctx, TestCondition Cond,
+ __int128_t LHS, __int128_t RHS,
+ const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
+
+template bool test<unsigned char>(RunContext *Ctx, TestCondition Cond,
+ unsigned char LHS, unsigned char RHS,
const char *LHSStr, const char *RHSStr,
const char *File, unsigned long Line);
-template bool Test::test<short, 0>(TestCondition Cond, short LHS, short RHS,
+template bool test<unsigned short>(RunContext *Ctx, TestCondition Cond,
+ unsigned short LHS, unsigned short RHS,
const char *LHSStr, const char *RHSStr,
const char *File, unsigned long Line);
-template bool Test::test<int, 0>(TestCondition Cond, int LHS, int RHS,
+template bool test<unsigned int>(RunContext *Ctx, TestCondition Cond,
+ unsigned int LHS, unsigned int RHS,
const char *LHSStr, const char *RHSStr,
const char *File, unsigned long Line);
-template bool Test::test<long, 0>(TestCondition Cond, long LHS, long RHS,
+template bool test<unsigned long>(RunContext *Ctx, TestCondition Cond,
+ unsigned long LHS, unsigned long RHS,
const char *LHSStr, const char *RHSStr,
const char *File, unsigned long Line);
-template bool Test::test<long long, 0>(TestCondition Cond, long long LHS,
- long long RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
-
-template bool Test::test<__int128_t, 0>(TestCondition Cond, __int128_t LHS,
- __int128_t RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
-
-template bool Test::test<unsigned char, 0>(TestCondition Cond,
- unsigned char LHS, unsigned char RHS,
- const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
-
-template bool
-Test::test<unsigned short, 0>(TestCondition Cond, unsigned short LHS,
- unsigned short RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
-
-template bool Test::test<unsigned int, 0>(TestCondition Cond, unsigned int LHS,
- unsigned int RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
+template bool test<bool>(RunContext *Ctx, TestCondition Cond, bool LHS,
+ bool RHS, const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
-template bool Test::test<unsigned long, 0>(TestCondition Cond,
- unsigned long LHS, unsigned long RHS,
- const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
+template bool test<unsigned long long>(RunContext *Ctx, TestCondition Cond,
+ unsigned long long LHS,
+ unsigned long long RHS,
+ const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
-template bool Test::test<bool, 0>(TestCondition Cond, bool LHS, bool RHS,
- const char *LHSStr, const char *RHSStr,
- const char *File, unsigned long Line);
+template bool test<__uint128_t>(RunContext *Ctx, TestCondition Cond,
+ __uint128_t LHS, __uint128_t RHS,
+ const char *LHSStr, const char *RHSStr,
+ const char *File, unsigned long Line);
-template bool
-Test::test<unsigned long long, 0>(TestCondition Cond, unsigned long long LHS,
- unsigned long long RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
-
-template bool Test::test<__uint128_t, 0>(TestCondition Cond, __uint128_t LHS,
- __uint128_t RHS, const char *LHSStr,
- const char *RHSStr, const char *File,
- unsigned long Line);
+} // namespace internal
bool Test::testStrEq(const char *LHS, const char *RHS, const char *LHSStr,
const char *RHSStr, const char *File, unsigned long Line) {