Skip to content

Commit 6624d61

Browse files
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 d267e01 commit 6624d61

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Diff for: hardware/arduino/avr/cores/arduino/WString.cpp

+3-3
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);

Diff for: hardware/arduino/avr/cores/arduino/WString.h

+3-3
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
};

Diff for: hardware/arduino/sam/cores/arduino/WString.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ String::String(const __FlashStringHelper *pstr)
4545
*this = pstr;
4646
}
4747

48-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
48+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
4949
String::String(String &&rval)
5050
{
5151
init();
@@ -191,7 +191,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
191191
return *this;
192192
}
193193

194-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
194+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
195195
void String::move(String &rhs)
196196
{
197197
if (buffer) {
@@ -223,7 +223,7 @@ String & String::operator = (const String &rhs)
223223
return *this;
224224
}
225225

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

Diff for: hardware/arduino/sam/cores/arduino/WString.h

+3-3
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)