[PATCH] ios: Don't return & for fpos - and + operators

Rosen Penev rosenp at gmail.com
Thu Oct 10 04:06:00 UTC 2019


Throws a Weffc++ warning:

warning: ‘std::fpos<state>& std::fpos<state>::operator+(const streamoff&)’
should return by value [-Weffc++]

A similar change was made to gcc's libstdcpp back in 2001.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 include/ios | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/ios b/include/ios
index ac6566a..87d6c3a 100644
--- a/include/ios
+++ b/include/ios
@@ -478,11 +478,11 @@ namespace std{
 		_UCXXEXPORT bool operator!=(const fpos &rhs){
 			return st != rhs.st;
 		}
-		_UCXXEXPORT fpos & operator+(const streamoff & o){
+		_UCXXEXPORT fpos operator+(const streamoff & o){
 			st += o;
 			return *this;
 		}
-		_UCXXEXPORT fpos & operator-(const streamoff & o){
+		_UCXXEXPORT fpos operator-(const streamoff & o){
 			st -= o;
 			return *this;
 		}
-- 
2.17.1



More information about the uClibc mailing list