Skip to content

Commit f6b2a22

Browse files
[libc] Move struct Sign into LIBC_NAMESPACE (#110709)
The struct Sign should be in the correct namespace. Also update the various tests that use it.
1 parent 4206c37 commit f6b2a22

31 files changed

+57
-0
lines changed

libc/src/__support/sign.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
1313

14+
namespace LIBC_NAMESPACE_DECL {
15+
1416
// A type to interact with signed arithmetic types.
1517
struct Sign {
1618
LIBC_INLINE constexpr bool is_pos() const { return !is_negative; }
@@ -37,4 +39,5 @@ struct Sign {
3739
LIBC_INLINE_VAR constexpr Sign Sign::NEG = Sign(true);
3840
LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false);
3941

42+
} // namespace LIBC_NAMESPACE_DECL
4043
#endif // LLVM_LIBC_SRC___SUPPORT_SIGN_H

libc/test/UnitTest/FPMatcher.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "hdr/math_macros.h"
2323

24+
using LIBC_NAMESPACE::Sign;
25+
2426
namespace LIBC_NAMESPACE_DECL {
2527
namespace testing {
2628

libc/test/src/__support/FPUtil/dyadic_float_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Float128 = LIBC_NAMESPACE::fputil::DyadicFloat<128>;
1717
using Float192 = LIBC_NAMESPACE::fputil::DyadicFloat<192>;
1818
using Float256 = LIBC_NAMESPACE::fputil::DyadicFloat<256>;
19+
using LIBC_NAMESPACE::Sign;
1920

2021
TEST(LlvmLibcDyadicFloatTest, BasicConversions) {
2122
Float128 x(Sign::POS, /*exponent*/ 0,

libc/test/src/__support/FPUtil/fpbits_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "src/__support/sign.h" // Sign
1414
#include "test/UnitTest/Test.h"
1515

16+
using LIBC_NAMESPACE::Sign;
1617
using LIBC_NAMESPACE::fputil::FPBits;
1718
using LIBC_NAMESPACE::fputil::FPType;
1819
using LIBC_NAMESPACE::fputil::internal::FPRep;

libc/test/src/math/FDimTest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "test/UnitTest/FPMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

16+
using LIBC_NAMESPACE::Sign;
17+
1618
template <typename T>
1719
class FDimTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
1820
public:

libc/test/src/math/HypotTest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "hdr/math_macros.h"
1919

20+
using LIBC_NAMESPACE::Sign;
21+
2022
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
2123

2224
template <typename T>

libc/test/src/math/ILogbTest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "test/UnitTest/FEnvSafeTest.h"
1717
#include "test/UnitTest/Test.h"
1818

19+
using LIBC_NAMESPACE::Sign;
20+
1921
class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
2022
public:
2123
template <typename T> struct ILogbFunc {

libc/test/src/math/LdExpTest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "hdr/math_macros.h"
2020
#include <stdint.h>
2121

22+
using LIBC_NAMESPACE::Sign;
23+
2224
template <typename T>
2325
class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
2426
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;

libc/test/src/math/NextAfterTest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "test/UnitTest/FPMatcher.h"
1919
#include "test/UnitTest/Test.h"
2020

21+
using LIBC_NAMESPACE::Sign;
22+
2123
template <typename T>
2224
class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
2325
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;

libc/test/src/math/RIntTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "hdr/math_macros.h"
2222

2323
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
24+
using LIBC_NAMESPACE::Sign;
2425

2526
static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
2627
FE_TONEAREST};

0 commit comments

Comments
 (0)