Skip to content

Commit 728d723

Browse files
committed
Merge branch 'cxx11'
2 parents 8ebc4be + 1f09fc9 commit 728d723

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

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

cores/arduino/WString.h

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/*
2-
Copyright (c) 2014 Arduino. All right reserved.
2+
WString.h - String library for Wiring & Arduino
3+
...mostly rewritten by Paul Stoffregen...
4+
Copyright (c) 2009-10 Hernando Barragan. All right reserved.
5+
Copyright 2011, Paul Stoffregen, [email protected]
36
47
This library is free software; you can redistribute it and/or
58
modify it under the terms of the GNU Lesser General Public
@@ -8,8 +11,8 @@
811
912
This library is distributed in the hope that it will be useful,
1013
but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12-
See the GNU Lesser General Public License for more details.
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
1316
1417
You should have received a copy of the GNU Lesser General Public
1518
License along with this library; if not, write to the Free Software
@@ -56,7 +59,7 @@ class String
5659
String(const char *cstr = "");
5760
String(const String &str);
5861
String(const __FlashStringHelper *str);
59-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
62+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
6063
String(String &&rval);
6164
String(StringSumHelper &&rval);
6265
#endif
@@ -78,21 +81,21 @@ class String
7881
inline unsigned int length(void) const {return len;}
7982

8083
// creates a copy of the assigned value. if the value is null or
81-
// invalid, or if the memory allocation fails, the string will be
84+
// invalid, or if the memory allocation fails, the string will be
8285
// marked as invalid ("if (s)" will be false).
8386
String & operator = (const String &rhs);
8487
String & operator = (const char *cstr);
8588
String & operator = (const __FlashStringHelper *str);
86-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
89+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
8790
String & operator = (String &&rval);
8891
String & operator = (StringSumHelper &&rval);
8992
#endif
9093

9194
// concatenate (works w/ built-in types)
92-
95+
9396
// returns true on success, false on failure (in which case, the string
94-
// is left unchanged). if the argument is null or invalid, the
95-
// concatenation is considered unsucessful.
97+
// is left unchanged). if the argument is null or invalid, the
98+
// concatenation is considered unsucessful.
9699
unsigned char concat(const String &str);
97100
unsigned char concat(const char *cstr);
98101
unsigned char concat(char c);
@@ -104,7 +107,7 @@ class String
104107
unsigned char concat(float num);
105108
unsigned char concat(double num);
106109
unsigned char concat(const __FlashStringHelper * str);
107-
110+
108111
// if there's not enough memory for the concatenated value, the string
109112
// will be left unchanged (but this isn't signalled in any way)
110113
String & operator += (const String &rhs) {concat(rhs); return (*this);}
@@ -197,7 +200,7 @@ class String
197200
// copy and move
198201
String & copy(const char *cstr, unsigned int length);
199202
String & copy(const __FlashStringHelper *pstr, unsigned int length);
200-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
203+
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
201204
void move(String &rhs);
202205
#endif
203206
};

platform.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ compiler.warning_flags.all=-Wall -Wextra
3333

3434
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
3535
compiler.c.cmd=arm-none-eabi-gcc
36-
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
36+
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
3737
compiler.c.elf.cmd=arm-none-eabi-gcc
3838
compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps
3939
compiler.S.cmd=arm-none-eabi-gcc
4040
compiler.S.flags=-c -g -x assembler-with-cpp
4141
compiler.cpp.cmd=arm-none-eabi-g++
42-
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
42+
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
4343
compiler.ar.cmd=arm-none-eabi-ar
4444
compiler.ar.flags=rcs
4545
compiler.objcopy.cmd=arm-none-eabi-objcopy

0 commit comments

Comments
 (0)