Skip to content

Commit 72a5ef3

Browse files
matthijskooijmancmaglie
authored andcommitted
Check for __cplusplus >= 201103L as well as __GXX_EXPERIMENTAL_CXX0X__
Gcc 4.8 defines __cplusplus as 201103L, so we can check for that now. It still also defines __GXX_EXPERIMENTAL_CXX0X__, but this could help on other compilers, or if gcc ever decides to stop defining the experimental macro.
1 parent c84ff4d commit 72a5ef3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cores/arduino/WString.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ String::String(const __FlashStringHelper *pstr)
4343
*this = pstr;
4444
}
4545

46-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
46+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
4747
String::String(String &&rval)
4848
{
4949
init();
@@ -189,7 +189,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
189189
return *this;
190190
}
191191

192-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
192+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
193193
void String::move(String &rhs)
194194
{
195195
if (buffer) {
@@ -221,7 +221,7 @@ String & String::operator = (const String &rhs)
221221
return *this;
222222
}
223223

224-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
224+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
225225
String & String::operator = (String &&rval)
226226
{
227227
if (this != &rval) move(rval);

cores/arduino/WString.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class String
5959
String(const char *cstr = "");
6060
String(const String &str);
6161
String(const __FlashStringHelper *str);
62-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
62+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
6363
String(String &&rval);
6464
String(StringSumHelper &&rval);
6565
#endif
@@ -86,7 +86,7 @@ class String
8686
String & operator = (const String &rhs);
8787
String & operator = (const char *cstr);
8888
String & operator = (const __FlashStringHelper *str);
89-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
89+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
9090
String & operator = (String &&rval);
9191
String & operator = (StringSumHelper &&rval);
9292
#endif
@@ -200,7 +200,7 @@ class String
200200
// copy and move
201201
String & copy(const char *cstr, unsigned int length);
202202
String & copy(const __FlashStringHelper *pstr, unsigned int length);
203-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
203+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
204204
void move(String &rhs);
205205
#endif
206206
};

0 commit comments

Comments
 (0)