Compare commits

...

1 Commits

Author SHA1 Message Date
c5df271a1a Remove trailing spaces 2021-10-25 07:27:47 -04:00
5 changed files with 312 additions and 312 deletions

View File

@ -99,8 +99,8 @@ anchors:
"libc6-dbg", "libc6-dbg",
"libc++-dev", "libc++-dev",
"libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-8", "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-8",
"ubuntu-toolchain-r-test" ] } } "ubuntu-toolchain-r-test" ] } }
gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ] } } gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ] } }
gcc-49: &gcc-49 { apt: { packages: [ "g++-4.9" ], sources: [ "ubuntu-toolchain-r-test" ] } } gcc-49: &gcc-49 { apt: { packages: [ "g++-4.9" ], sources: [ "ubuntu-toolchain-r-test" ] } }
gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ] } } gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ] } }
@ -190,7 +190,7 @@ jobs:
- { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=14,17" ], addons: *clang-6 } - { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=14,17" ], addons: *clang-6 }
- { os: "linux", env: [ "B2_TOOLSET=clang-7", "B2_CXXSTD=17" ], addons: *clang-7 } - { os: "linux", env: [ "B2_TOOLSET=clang-7", "B2_CXXSTD=17" ], addons: *clang-7 }
- { os: "linux", env: [ "B2_TOOLSET=clang-8", "B2_CXXSTD=17" ], addons: *clang-8 } - { os: "linux", env: [ "B2_TOOLSET=clang-8", "B2_CXXSTD=17" ], addons: *clang-8 }
- os: "linux" - os: "linux"
env: ["B2_TOOLSET=clang-9", "B2_CXXSTD=11,14,17"] env: ["B2_TOOLSET=clang-9", "B2_CXXSTD=11,14,17"]
addons: addons:
@ -203,8 +203,8 @@ jobs:
- clang-9 - clang-9
- libc6-dbg - libc6-dbg
- libc++-dev - libc++-dev
- libstdc++-8-dev - libstdc++-8-dev
# libc++ # libc++
- { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=11,14", - { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=11,14",
"B2_CXXFLAGS=-stdlib=libc++" ], addons: *clang-6 } "B2_CXXFLAGS=-stdlib=libc++" ], addons: *clang-6 }
@ -246,7 +246,7 @@ jobs:
script: script:
- cd $BOOST_ROOT/libs/$SELF - cd $BOOST_ROOT/libs/$SELF
- ci/travis/coverity.sh - ci/travis/coverity.sh
# Standalone tests for StaticString # Standalone tests for StaticString
- { os: "linux", env: [ "COMMENT=STANDALONE", "B2_TOOLSET=gcc-7", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ], addons: *gcc-7 } - { os: "linux", env: [ "COMMENT=STANDALONE", "B2_TOOLSET=gcc-7", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ], addons: *gcc-7 }
- { os: "linux", env: [ "COMMENT=STANDALONE", "B2_TOOLSET=gcc-8", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ], addons: *gcc-8 } - { os: "linux", env: [ "COMMENT=STANDALONE", "B2_TOOLSET=gcc-8", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ], addons: *gcc-8 }
@ -267,9 +267,9 @@ jobs:
- libc6-dbg - libc6-dbg
- libc++-dev - libc++-dev
- libstdc++-8-dev - libstdc++-8-dev
- { os: "osx" , env: [ "COMMENT=STANDALONE", "B2_TOOLSET=clang", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ] } - { os: "osx" , env: [ "COMMENT=STANDALONE", "B2_TOOLSET=clang", "B2_DEFINES=define=BOOST_STATIC_STRING_STANDALONE", "B2_CXXSTD=17" ] }
notifications: notifications:
email: email:
false false

View File

@ -20,7 +20,7 @@
#endif #endif
// Include <version> if we can // Include <version> if we can
#ifdef __has_include #ifdef __has_include
#if __has_include(<version>) #if __has_include(<version>)
#include <version> #include <version>
#endif #endif
@ -45,7 +45,7 @@
#define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) __has_cpp_attribute(x) #define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) __has_cpp_attribute(x)
#elif defined(__has_attribute) #elif defined(__has_attribute)
#define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) __has_attribute(x) #define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) __has_attribute(x)
#else #else
#define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) 0 #define BOOST_STATIC_STRING_CHECK_FOR_ATTR(x) 0
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -41,14 +41,14 @@ struct cxper_char_traits
*(dest++) = *(src++); *(dest++) = *(src++);
return temp; return temp;
} }
static constexpr char_type* copy(char_type* dest, const char_type* src, std::size_t n) static constexpr char_type* copy(char_type* dest, const char_type* src, std::size_t n)
{ {
const auto temp = dest; const auto temp = dest;
while (n--) while (n--)
*(dest++) = *(src++); *(dest++) = *(src++);
return temp; return temp;
} }
static constexpr char_type* assign(char_type* dest, std::size_t n, char_type ch) static constexpr char_type* assign(char_type* dest, std::size_t n, char_type ch)
{ {
const auto temp = dest; const auto temp = dest;
while (n--) while (n--)
@ -62,8 +62,8 @@ using cxper_char_traits = std::char_traits<char>;
using cstatic_string = basic_static_string<50, char, cxper_char_traits>; using cstatic_string = basic_static_string<50, char, cxper_char_traits>;
inline inline
constexpr constexpr
bool bool
testConstantEvaluation() testConstantEvaluation()
{ {
#ifdef BOOST_STATIC_STRING_CPP20 #ifdef BOOST_STATIC_STRING_CPP20
@ -421,7 +421,7 @@ testConstantEvaluation()
// ends_with // ends_with
a.ends_with('a'); a.ends_with('a');
a.ends_with("a"); a.ends_with("a");
return true; return true;
#elif defined(BOOST_STATIC_STRING_CPP14) #elif defined(BOOST_STATIC_STRING_CPP14)
// c++14 constexpr tests // c++14 constexpr tests
@ -521,17 +521,17 @@ testConstantEvaluation()
a.compare("a"); a.compare("a");
a.compare(0, 1, "a"); a.compare(0, 1, "a");
a.compare(0, 1, "a", 1); a.compare(0, 1, "a", 1);
// substr // substr
// in gcc 5, a constexpr non-static member function returning the class // in gcc 5, a constexpr non-static member function returning the class
// is a member of causes an ICE // is a member of causes an ICE
#ifndef BOOST_STATIC_STRING_GCC5_BAD_CONSTEXPR #ifndef BOOST_STATIC_STRING_GCC5_BAD_CONSTEXPR
a.substr(0, 1); a.substr(0, 1);
#endif #endif
// subview // subview
a.subview(0); a.subview(0);
// copy // copy
char k[20]{}; char k[20]{};
a.copy(k, 1, 0); a.copy(k, 1, 0);
@ -596,9 +596,9 @@ testConstantEvaluation()
return true; return true;
#elif defined(BOOST_STATIC_STRING_CPP11) #elif defined(BOOST_STATIC_STRING_CPP11)
// c++11 constexpr tests // c++11 constexpr tests
return (cstatic_string().size() + return (cstatic_string().size() +
cstatic_string().length() + cstatic_string().length() +
cstatic_string().max_size() + cstatic_string().max_size() +
cstatic_string().capacity()) != 0 && cstatic_string().capacity()) != 0 &&
cstatic_string().empty(); cstatic_string().empty();
#endif #endif

View File

@ -24,7 +24,7 @@ namespace boost {
namespace static_strings { namespace static_strings {
template class basic_static_string<420, char>; template class basic_static_string<420, char>;
using string_view = basic_string_view<char, std::char_traits<char>>; using string_view = basic_string_view<char, std::char_traits<char>>;
template <class S> template <class S>
@ -110,7 +110,7 @@ testA(S s, const typename S::value_type* str, typename S::size_type n, S expecte
return s.append(str, n) == expected; return s.append(str, n) == expected;
} }
int int
sign(int x) sign(int x)
{ {
if (x == 0) if (x == 0)
@ -216,7 +216,7 @@ testR(S s, typename S::size_type pos, typename S::size_type n1, const typename S
// this is a precondition violation for the const_iterator overload // this is a precondition violation for the const_iterator overload
return s.replace(pos, n1, str, n2) == expected; return s.replace(pos, n1, str, n2) == expected;
else else
return s.replace(pos, n1, str, n2) == expected && return s.replace(pos, n1, str, n2) == expected &&
s0.replace(s0.begin() + pos, s0.begin() + pos + n1, str, str + n2) == expected; s0.replace(s0.begin() + pos, s0.begin() + pos + n1, str, str + n2) == expected;
} }
else else
@ -399,7 +399,7 @@ testAssignment()
BOOST_TEST(static_string<3>{}.assign("abc", 3) == "abc"); BOOST_TEST(static_string<3>{}.assign("abc", 3) == "abc");
BOOST_TEST(static_string<3>{"*"}.assign("abc", 3) == "abc"); BOOST_TEST(static_string<3>{"*"}.assign("abc", 3) == "abc");
BOOST_TEST_THROWS(static_string<1>{}.assign("abc", 3), std::length_error); BOOST_TEST_THROWS(static_string<1>{}.assign("abc", 3), std::length_error);
// assign(CharT const* s) // assign(CharT const* s)
BOOST_TEST(static_string<3>{}.assign("abc") == "abc"); BOOST_TEST(static_string<3>{}.assign("abc") == "abc");
BOOST_TEST(static_string<3>{"*"}.assign("abc") == "abc"); BOOST_TEST(static_string<3>{"*"}.assign("abc") == "abc");
@ -413,7 +413,7 @@ testAssignment()
BOOST_TEST(static_string<4>{"*"}.assign(cs.begin(), cs.end()) == "abcd"); BOOST_TEST(static_string<4>{"*"}.assign(cs.begin(), cs.end()) == "abcd");
BOOST_TEST_THROWS(static_string<2>{"*"}.assign(cs.begin(), cs.end()), std::length_error); BOOST_TEST_THROWS(static_string<2>{"*"}.assign(cs.begin(), cs.end()), std::length_error);
} }
// assign(std::initializer_list<CharT> ilist) // assign(std::initializer_list<CharT> ilist)
BOOST_TEST(static_string<3>{}.assign({'a', 'b', 'c'}) == "abc"); BOOST_TEST(static_string<3>{}.assign({'a', 'b', 'c'}) == "abc");
BOOST_TEST(static_string<3>{"*"}.assign({'a', 'b', 'c'}) == "abc"); BOOST_TEST(static_string<3>{"*"}.assign({'a', 'b', 'c'}) == "abc");
@ -451,7 +451,7 @@ testAssignment()
BOOST_TEST_THROWS(static_string<2>{"**"}.assign(T{}, 6, 3), std::out_of_range); BOOST_TEST_THROWS(static_string<2>{"**"}.assign(T{}, 6, 3), std::out_of_range);
BOOST_TEST_THROWS(static_string<2>{"**"}.assign(T{}, 1, 3), std::length_error); BOOST_TEST_THROWS(static_string<2>{"**"}.assign(T{}, 1, 3), std::length_error);
} }
//--- //---
{ {
@ -472,7 +472,7 @@ testAssignment()
s3 = s1, s3 = s1,
std::length_error); std::length_error);
} }
{ {
static_string<3> s1; static_string<3> s1;
s1 = "123"; s1 = "123";
@ -686,7 +686,7 @@ testElements()
BOOST_TEST(static_string<3>{"abc"}.at(2) == 'c'); BOOST_TEST(static_string<3>{"abc"}.at(2) == 'c');
BOOST_TEST_THROWS(static_string<3>{""}.at(0), std::out_of_range); BOOST_TEST_THROWS(static_string<3>{""}.at(0), std::out_of_range);
BOOST_TEST_THROWS(static_string<3>{"abc"}.at(4), std::out_of_range); BOOST_TEST_THROWS(static_string<3>{"abc"}.at(4), std::out_of_range);
// at(size_type pos) const // at(size_type pos) const
BOOST_TEST(cfs3{"abc"}.at(0) == 'a'); BOOST_TEST(cfs3{"abc"}.at(0) == 'a');
BOOST_TEST(cfs3{"abc"}.at(2) == 'c'); BOOST_TEST(cfs3{"abc"}.at(2) == 'c');
@ -717,7 +717,7 @@ testElements()
BOOST_TEST(static_string<3>{"a"}.back() == 'a'); BOOST_TEST(static_string<3>{"a"}.back() == 'a');
BOOST_TEST(static_string<3>{"abc"}.back() == 'c'); BOOST_TEST(static_string<3>{"abc"}.back() == 'c');
// back() const // back() const
BOOST_TEST(cfs3{"a"}.back() == 'a'); BOOST_TEST(cfs3{"a"}.back() == 'a');
BOOST_TEST(cfs3{"abc"}.back() == 'c'); BOOST_TEST(cfs3{"abc"}.back() == 'c');
@ -924,7 +924,7 @@ testInsert()
BOOST_TEST(static_string<4>{"ad"}.insert(1, "bcd", 2) == "abcd"); BOOST_TEST(static_string<4>{"ad"}.insert(1, "bcd", 2) == "abcd");
BOOST_TEST_THROWS(static_string<4>{"abc"}.insert(4, "*"), std::out_of_range); BOOST_TEST_THROWS(static_string<4>{"abc"}.insert(4, "*"), std::out_of_range);
BOOST_TEST_THROWS(static_string<3>{"abc"}.insert(1, "*"), std::length_error); BOOST_TEST_THROWS(static_string<3>{"abc"}.insert(1, "*"), std::length_error);
// insert(size_type index, string_view_type sv) // insert(size_type index, string_view_type sv)
BOOST_TEST(static_string<3>{"ac"}.insert(1, sv{"b"}) == "abc"); BOOST_TEST(static_string<3>{"ac"}.insert(1, sv{"b"}) == "abc");
BOOST_TEST_THROWS(static_string<4>{"abc"}.insert(4, sv{"*"}), std::out_of_range); BOOST_TEST_THROWS(static_string<4>{"abc"}.insert(4, sv{"*"}), std::out_of_range);
@ -1639,7 +1639,7 @@ testInsert()
BOOST_TEST(testI(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"))); BOOST_TEST(testI(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")));
} }
// done // done
static static
void void
testErase() testErase()
@ -3754,7 +3754,7 @@ testToStaticString()
BOOST_TEST(testTS(std::numeric_limits<unsigned long long>::max())); BOOST_TEST(testTS(std::numeric_limits<unsigned long long>::max()));
BOOST_TEST(testTS(std::numeric_limits<long double>::min())); BOOST_TEST(testTS(std::numeric_limits<long double>::min()));
BOOST_TEST(testTS(std::numeric_limits<float>::min())); BOOST_TEST(testTS(std::numeric_limits<float>::min()));
// these tests technically are not portable, but they will work // these tests technically are not portable, but they will work
// 99% of the time. // 99% of the time.
{ {
@ -4136,7 +4136,7 @@ testFind()
BOOST_TEST(fs1.rfind(cs1, 0) == 0); BOOST_TEST(fs1.rfind(cs1, 0) == 0);
BOOST_TEST(fs1.rfind(cs2, 0) == S::npos); BOOST_TEST(fs1.rfind(cs2, 0) == S::npos);
BOOST_TEST(fs1.rfind(cs2, 0, 2) == S::npos); BOOST_TEST(fs1.rfind(cs2, 0, 2) == S::npos);
BOOST_TEST(fs1.rfind(cs1, 4) == 0); BOOST_TEST(fs1.rfind(cs1, 4) == 0);
@ -5114,7 +5114,7 @@ testFind()
// find_first_not_of // find_first_not_of
const char* cs3 = "12456"; const char* cs3 = "12456";
@ -5963,7 +5963,7 @@ testReplace()
std::stringstream a("defghi"); std::stringstream a("defghi");
static_string<30> b = "abcabcdefjklmnop"; static_string<30> b = "abcabcdefjklmnop";
BOOST_TEST(b.replace(b.begin() + 3, b.begin() + 9, BOOST_TEST(b.replace(b.begin() + 3, b.begin() + 9,
std::istream_iterator<char>(a), std::istream_iterator<char>(a),
std::istream_iterator<char>()) == std::istream_iterator<char>()) ==
"abcdefghijklmnop"); "abcdefghijklmnop");
} }
@ -6176,7 +6176,7 @@ testReplace()
BOOST_TEST(testR(S("abcde"), 5, 1, 5, '2', S("abcde22222"))); BOOST_TEST(testR(S("abcde"), 5, 1, 5, '2', S("abcde22222")));
BOOST_TEST(testR(S("abcde"), 5, 1, 10, '2', S("abcde2222222222"))); BOOST_TEST(testR(S("abcde"), 5, 1, 10, '2', S("abcde2222222222")));
BOOST_TEST(testR(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222"))); BOOST_TEST(testR(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222")));
BOOST_TEST(testR(S("abcde"), 0, 4, "12345", 4, S("1234e"))); BOOST_TEST(testR(S("abcde"), 0, 4, "12345", 4, S("1234e")));
BOOST_TEST(testR(S("abcde"), 0, 4, "12345", 5, S("12345e"))); BOOST_TEST(testR(S("abcde"), 0, 4, "12345", 5, S("12345e")));
BOOST_TEST(testR(S("abcde"), 0, 4, "1234567890", 0, S("e"))); BOOST_TEST(testR(S("abcde"), 0, 4, "1234567890", 0, S("e")));
@ -7205,13 +7205,13 @@ runTests()
static_cast<void>(cxper); static_cast<void>(cxper);
testConstruct(); testConstruct();
testAssignment(); testAssignment();
testElements(); testElements();
testIterators(); testIterators();
testCapacity(); testCapacity();
testClear(); testClear();