6e13f22c8a505b838790b9f1bd99da24e7aa887a
[openwrt/openwrt.git] / package / libs / uclibc++ / patches / 004-uClibc-Make-long-long-available-to-C-11.patch
1 From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001
2 From: Rosen Penev <rosenp@gmail.com>
3 Date: Thu, 3 Oct 2019 18:58:43 -0700
4 Subject: [PATCH] uClibc++: Make long long available to C++11
5
6 C++11 makes long long available. It is no longer a GNU extension.
7
8 Signed-off-by: Rosen Penev <rosenp@gmail.com>
9 ---
10 include/istream | 4 ++--
11 include/istream_helpers | 2 +-
12 include/ostream | 8 ++++----
13 include/ostream_helpers | 8 ++++----
14 tests/sstreamtest.cpp | 4 ++--
15 5 files changed, 13 insertions(+), 13 deletions(-)
16
17 --- a/include/istream
18 +++ b/include/istream
19 @@ -72,7 +72,7 @@ namespace std{
20 basic_istream<charT,traits>& operator>>(void*& p);
21 basic_istream<charT,traits>& operator>>(basic_streambuf<char_type,traits>* sb);
22
23 -#ifndef __STRICT_ANSI__
24 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
25 basic_istream<charT,traits>& operator>>(long long& n);
26 basic_istream<charT,traits>& operator>>(unsigned long long& n);
27 #endif
28 @@ -455,7 +455,7 @@ namespace std{
29 return *this;
30 }
31
32 -#ifndef __STRICT_ANSI__
33 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
34 template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>&
35 basic_istream<charT,traits>::operator>>(long long& n)
36 {
37 --- a/include/istream_helpers
38 +++ b/include/istream_helpers
39 @@ -301,7 +301,7 @@ namespace std{
40 };
41
42
43 -#ifndef __STRICT_ANSI__
44 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
45 template <class traits> class _UCXXEXPORT __istream_readin<traits, char, long long>{
46 public:
47 inline static void readin(basic_istream<char, traits >& stream, long long & var)
48 --- a/include/ostream
49 +++ b/include/ostream
50 @@ -85,7 +85,7 @@ namespace std {
51 basic_ostream<charT,traits>& operator<<(long double f);
52 basic_ostream<charT,traits>& operator<<(void* p);
53 basic_ostream<charT,traits>& operator<<(basic_streambuf<char_type,traits>* sb);
54 -#ifndef __STRICT_ANSI__
55 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
56 basic_ostream<charT,traits>& operator<<(long long n);
57 basic_ostream<charT,traits>& operator<<(unsigned long long n);
58 #endif
59 @@ -221,7 +221,7 @@ namespace std {
60 return *this;
61 }
62
63 -#ifndef __STRICT_ANSI__
64 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
65 template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(long long n)
66 {
67 sentry s(*this);
68 @@ -487,7 +487,7 @@ namespace std {
69 #endif
70
71
72 -#ifndef __STRICT_ANSI__
73 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
74
75 //Support for output of long long data types
76
77 @@ -509,7 +509,7 @@ template<class Ch, class Tr> _UCXXEXPORT
78 }
79
80
81 -#endif //__STRICT_ANSI__
82 +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
83
84
85
86 --- a/include/ostream_helpers
87 +++ b/include/ostream_helpers
88 @@ -142,7 +142,7 @@ namespace std{
89 }
90 };
91
92 -#ifndef __STRICT_ANSI__
93 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
94
95 template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, signed long long int>{
96 public:
97 @@ -237,7 +237,7 @@ namespace std{
98 };
99
100
101 -#endif //__STRICT_ANSI__
102 +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
103
104 template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, double>{
105 public:
106 @@ -357,7 +357,7 @@ namespace std{
107 }
108 };
109
110 -#ifndef __STRICT_ANSI__
111 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
112
113 template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, signed long long int>{
114 public:
115 @@ -428,7 +428,7 @@ namespace std{
116 };
117
118
119 -#endif //__STRICT_ANSI__
120 +#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
121
122 template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, double>{
123 public:
124 --- a/tests/sstreamtest.cpp
125 +++ b/tests/sstreamtest.cpp
126 @@ -9,7 +9,7 @@ int main(){
127 int i;
128 std::string s;
129 char c;
130 -#ifndef __STRICT_ANSI__
131 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
132 long long ll;
133 unsigned long long ull;
134 #endif
135 @@ -32,7 +32,7 @@ int main(){
136
137
138
139 -#ifndef __STRICT_ANSI__
140 +#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
141 a.str("678 76 54");
142 a >> ll >> ull >> s;
143 std::cout << "ll (should be 678): " << ll << std::endl;