From rep.dot.nop at gmail.com Fri Oct 4 10:30:52 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:30:52 +0200 Subject: [git commit] include: Remove unnecessary semicolons Message-ID: <20191004103258.8BA6D885D5@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=c165aee71f736a9599d4d4a1563fbbe394e849cf branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master Discovered with clang's -Wextra-semi Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/iterator_base | 4 ++-- include/stack | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/iterator_base b/include/iterator_base index 1cae589..e112a7f 100644 --- a/include/iterator_base +++ b/include/iterator_base @@ -139,7 +139,7 @@ namespace std{ public: typedef Iterator iterator_type; - reverse_iterator() : current(){}; + reverse_iterator() : current(){} explicit reverse_iterator(Iterator x) : current(x) { } template reverse_iterator(const reverse_iterator &x) : current(x.base()){} @@ -225,7 +225,7 @@ namespace std{ Container& container; public: typedef Container container_type; - explicit back_insert_iterator(Container& x):container(x) {}; + explicit back_insert_iterator(Container& x):container(x) {} back_insert_iterator& operator=(const typename Container::value_type& value){ container.push_back(value); return *this; diff --git a/include/stack b/include/stack index d4861b3..ea697f1 100644 --- a/include/stack +++ b/include/stack @@ -34,7 +34,7 @@ namespace std{ typedef typename Container::size_type size_type; typedef Container container_type; - explicit stack(const Container& a = Container()) : c(a) { }; + explicit stack(const Container& a = Container()) : c(a) { } bool empty() const { return c.empty(); } size_type size() const { return c.size(); } value_type& top() { return c.back(); } From rep.dot.nop at gmail.com Fri Oct 4 10:31:46 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:31:46 +0200 Subject: [git commit] iterator: Add missing parentheses Message-ID: <20191004103258.9DFEE81514@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=0dd45c2d767f80d9f194c100a3eb5e5c5e919ec0 branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master Clang warns: warning: '&&' within '||' [-Wlogical-op-parentheses] return sbuf == b.sbuf || is_eof() && b.is_eof(); Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/iterator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/iterator b/include/iterator index d65f467..3348d85 100644 --- a/include/iterator +++ b/include/iterator @@ -164,7 +164,7 @@ namespace std{ } bool equal(const istreambuf_iterator& b) const{ - return sbuf == b.sbuf || is_eof() && b.is_eof(); + return sbuf == b.sbuf || (is_eof() && b.is_eof()); } private: streambuf_type* sbuf; From rep.dot.nop at gmail.com Fri Oct 4 10:32:54 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:32:54 +0200 Subject: [git commit] include: Switch if to ifdef Message-ID: <20191004103258.B2CB2885D5@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=3523d9461c628746f478a11e20040b6c799f18c7 branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master Throws -Wundef warning in modern compilers. Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/cstdio | 2 +- include/new | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/cstdio b/include/cstdio index 8699385..f959ff5 100644 --- a/include/cstdio +++ b/include/cstdio @@ -65,7 +65,7 @@ namespace std{ using ::sprintf; using ::sscanf; using ::tmpfile; -#if _GLIBCXX_USE_TMPNAM +#ifdef _GLIBCXX_USE_TMPNAM using ::tmpnam; #endif using ::ungetc; diff --git a/include/new b/include/new index 6214b11..1dc33a4 100644 --- a/include/new +++ b/include/new @@ -39,13 +39,13 @@ namespace std{ _UCXXEXPORT void* operator new(std::size_t numBytes) _UCXX_THROW(std::bad_alloc); _UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT; -#if __cpp_sized_deallocation +#ifdef __cpp_sized_deallocation _UCXXEXPORT void operator delete(void* ptr, std::size_t) _UCXX_USE_NOEXCEPT; #endif _UCXXEXPORT void* operator new[](std::size_t numBytes) _UCXX_THROW(std::bad_alloc); _UCXXEXPORT void operator delete[](void * ptr) _UCXX_USE_NOEXCEPT; -#if __cpp_sized_deallocation +#ifdef __cpp_sized_deallocation _UCXXEXPORT void operator delete[](void * ptr, std::size_t) _UCXX_USE_NOEXCEPT; #endif From rep.dot.nop at gmail.com Fri Oct 4 10:37:51 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:37:51 +0200 Subject: [git commit] uClibc++: Make long long available to C++11 Message-ID: <20191004103258.F326181514@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=cbaa5bd24de748ad0687bf058f2392b1215f3648 branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master C++11 makes long long available. It is no longer a GNU extension. Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/istream | 4 ++-- include/istream_helpers | 2 +- include/ostream | 8 ++++---- include/ostream_helpers | 8 ++++---- tests/sstreamtest.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/istream b/include/istream index 72a8834..2d58abd 100644 --- a/include/istream +++ b/include/istream @@ -72,7 +72,7 @@ namespace std{ basic_istream& operator>>(void*& p); basic_istream& operator>>(basic_streambuf* sb); -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) basic_istream& operator>>(long long& n); basic_istream& operator>>(unsigned long long& n); #endif @@ -455,7 +455,7 @@ namespace std{ return *this; } -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template _UCXXEXPORT basic_istream& basic_istream::operator>>(long long& n) { diff --git a/include/istream_helpers b/include/istream_helpers index d87e0c7..f2c793f 100644 --- a/include/istream_helpers +++ b/include/istream_helpers @@ -301,7 +301,7 @@ namespace std{ }; -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template class _UCXXEXPORT __istream_readin{ public: inline static void readin(basic_istream& stream, long long & var) diff --git a/include/ostream b/include/ostream index 289514c..3072589 100644 --- a/include/ostream +++ b/include/ostream @@ -85,7 +85,7 @@ namespace std { basic_ostream& operator<<(long double f); basic_ostream& operator<<(void* p); basic_ostream& operator<<(basic_streambuf* sb); -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) basic_ostream& operator<<(long long n); basic_ostream& operator<<(unsigned long long n); #endif @@ -221,7 +221,7 @@ namespace std { return *this; } -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template _UCXXEXPORT basic_ostream& basic_ostream::operator<<(long long n) { sentry s(*this); @@ -487,7 +487,7 @@ namespace std { #endif -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) //Support for output of long long data types @@ -509,7 +509,7 @@ template _UCXXEXPORT basic_ostream& } -#endif //__STRICT_ANSI__ +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) diff --git a/include/ostream_helpers b/include/ostream_helpers index fa50407..f4d33f9 100644 --- a/include/ostream_helpers +++ b/include/ostream_helpers @@ -142,7 +142,7 @@ namespace std{ } }; -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template class _UCXXEXPORT __ostream_printout{ public: @@ -237,7 +237,7 @@ namespace std{ }; -#endif //__STRICT_ANSI__ +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template class _UCXXEXPORT __ostream_printout{ public: @@ -357,7 +357,7 @@ namespace std{ } }; -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template class _UCXXEXPORT __ostream_printout{ public: @@ -428,7 +428,7 @@ namespace std{ }; -#endif //__STRICT_ANSI__ +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) template class _UCXXEXPORT __ostream_printout{ public: diff --git a/tests/sstreamtest.cpp b/tests/sstreamtest.cpp index 36b3470..ea946a9 100644 --- a/tests/sstreamtest.cpp +++ b/tests/sstreamtest.cpp @@ -9,7 +9,7 @@ int main(){ int i; std::string s; char c; -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) long long ll; unsigned long long ull; #endif @@ -32,7 +32,7 @@ int main(){ -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) a.str("678 76 54"); a >> ll >> ull >> s; std::cout << "ll (should be 678): " << ll << std::endl; From rep.dot.nop at gmail.com Fri Oct 4 10:36:31 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:36:31 +0200 Subject: [git commit] cstdio: Add undef for four functions Message-ID: <20191004103258.E24AC81514@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=3791a7b3b5f6a4c806929d30671058fe105c61ef branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master When compiling with uClibc-ng, these functions get defined as macros and become unavailable for std. Fixes programs that use the std versions of these functions. This matches libstdcpp behavior. Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/cstdio | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/cstdio b/include/cstdio index f959ff5..0a42458 100644 --- a/include/cstdio +++ b/include/cstdio @@ -21,6 +21,15 @@ #ifndef __HEADER_CSTDIO #define __HEADER_CSTDIO 1 +#undef clearerr +#undef feof +#undef ferror +#undef fgetc +#undef fputc +#undef getc +#undef getchar +#undef putc +#undef putchar namespace std{ using ::FILE; From rep.dot.nop at gmail.com Fri Oct 4 10:33:43 2019 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 4 Oct 2019 12:33:43 +0200 Subject: [git commit] include: Replace C style casts with static_cast Message-ID: <20191004103258.C2CAC885D5@busybox.osuosl.org> commit: https://git.uclibc.org/uClibc++/commit/?id=c3ee60eca977032cbd4ce55b396c6e1121518f10 branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master Found with Clang's -Wold-style-cast Signed-off-by: Rosen Penev Signed-off-by: Bernhard Reutner-Fischer --- include/char_traits | 6 +++--- include/memory | 6 +++--- include/string | 2 +- include/vector | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/char_traits b/include/char_traits index 36eae36..1d33f39 100644 --- a/include/char_traits +++ b/include/char_traits @@ -52,7 +52,7 @@ namespace std{ static char_type to_char_type(const int_type & i); inline static int_type to_int_type(const char_type & c){ - return (short int)(unsigned char)c; + return static_cast(static_cast(c)); } inline static bool eq_int_type(const int_type & a, const int_type & b){ @@ -71,7 +71,7 @@ namespace std{ } inline static char_type* move(char_type* s1, const char_type* s2, size_t n){ - return (char*) memmove(s1, s2, n); + return static_cast(memmove(s1, s2, n)); } inline static char_type* copy(char_type* s1, const char_type* s2, size_t n){ @@ -82,7 +82,7 @@ namespace std{ } inline static char_type* assign(char_type* s, size_t n, char_type a){ - return (char *)memset(s, a, n); + return static_cast(memset(s, a, n)); } inline static int compare(const char_type* s1, const char_type* s2, size_t n){ diff --git a/include/memory b/include/memory index 9ce6559..37ac637 100644 --- a/include/memory +++ b/include/memory @@ -63,15 +63,15 @@ public: //Space for n Ts pointer allocate(size_type n, typename allocator::const_pointer = 0){ - return (T*)(::operator new( n * sizeof(T) )); + return static_cast(::operator new( n * sizeof(T) )); } void deallocate(pointer p, size_type){ ::operator delete(p); } //Use placement new to engage the constructor - void construct(pointer p, const T& val) { new((void*)p) T(val); } - void destroy(pointer p){ ((T*)p)->~T(); } //Call destructor + void construct(pointer p, const T& val) { new(static_cast(p)) T(val); } + void destroy(pointer p){ (static_cast(p))->~T(); } //Call destructor size_type max_size() const _UCXX_USE_NOEXCEPT; template struct rebind { typedef allocator other; }; diff --git a/include/string b/include/string index a790715..8cfa8b0 100644 --- a/include/string +++ b/include/string @@ -70,7 +70,7 @@ public: typedef typename vector::reverse_iterator reverse_iterator; typedef typename vector::const_reverse_iterator const_reverse_iterator; - static const size_type npos = (size_type)-1; + static const size_type npos = static_cast(-1); explicit _UCXXEXPORT basic_string(const A& al = A()) : vector(al){ return; } diff --git a/include/vector b/include/vector index 8310bc1..3cf64ed 100644 --- a/include/vector +++ b/include/vector @@ -180,7 +180,7 @@ namespace std{ } _UCXXEXPORT size_type max_size() const{ - return ((size_type)(-1)) / sizeof(T); + return static_cast(-1) / sizeof(T); } void downsize(size_type sz);