From 9d28b753a65ccef244c641b097d7ff6777c80ac7 Mon Sep 17 00:00:00 2001 From: G-o-T-o <89156641+G-o-T-o@users.noreply.github.com> Date: Tue, 24 Aug 2021 07:33:19 +0200 Subject: [PATCH 1/4] Update Sprite.cpp TODO's added regarding errors when compiling without 'build_flags = -w' option --- src/Display/Sprite.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Display/Sprite.cpp b/src/Display/Sprite.cpp index e602696..724b323 100644 --- a/src/Display/Sprite.cpp +++ b/src/Display/Sprite.cpp @@ -240,6 +240,14 @@ Sprite& Sprite::setPos(int32_t x, int32_t y){ return *this; } +/* TODO: + * when compiled without 'build_flags = -w' option the following error is issued: + * + * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::resize(uint, uint)': + * lib\CircuitOS\src\Display\Sprite.cpp:214:5: error: control reaches end of non-void function [-Werror=return-type] + * 214 | if(_created == false){ + * | ^~~~~~~~ +*/ Sprite& Sprite::resize(uint width, uint height){ if(!_created){ createSprite(width, height); @@ -257,10 +265,25 @@ Sprite& Sprite::resize(uint width, uint height){ } } +/* TODO: + * when compiled without 'build_flags = -w' option the following error is issued: + * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::setTransparent(bool)': + * lib\CircuitOS\src\Display\Sprite.cpp:221:1: error: no return statement in function returning non-void [-Werror=return-type] + * 221 | } + * | ^ +*/ Sprite& Sprite::setTransparent(bool transparent){ chroma = transparent; } +/* TODO: + * when compiled without 'build_flags = -w' option the following error is issued: + * + * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::setChroma(Color)': + * lib\CircuitOS\src\Display\Sprite.cpp:226:1: error: no return statement in function returning non-void [-Werror=return-type] + * 226 | } + * | ^ +*/ Sprite& Sprite::setChroma(Color color){ chromaKey = color; chroma = true; From 4f1f158db70f68da5cebe4a636bfbe6f28cf9c69 Mon Sep 17 00:00:00 2001 From: G-o-T-o <89156641+G-o-T-o@users.noreply.github.com> Date: Tue, 24 Aug 2021 13:44:41 +0200 Subject: [PATCH 2/4] Added missing return values to methods that expect one Added missing return values to: 1) Sprite& Sprite::resize(uint width, uint height) 2) Sprite& Sprite::setTransparent(bool transparent) 3) Sprite& Sprite::setChroma(Color color) --- src/Display/Sprite.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Display/Sprite.cpp b/src/Display/Sprite.cpp index 724b323..df2a97d 100644 --- a/src/Display/Sprite.cpp +++ b/src/Display/Sprite.cpp @@ -240,14 +240,6 @@ Sprite& Sprite::setPos(int32_t x, int32_t y){ return *this; } -/* TODO: - * when compiled without 'build_flags = -w' option the following error is issued: - * - * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::resize(uint, uint)': - * lib\CircuitOS\src\Display\Sprite.cpp:214:5: error: control reaches end of non-void function [-Werror=return-type] - * 214 | if(_created == false){ - * | ^~~~~~~~ -*/ Sprite& Sprite::resize(uint width, uint height){ if(!_created){ createSprite(width, height); @@ -263,30 +255,18 @@ Sprite& Sprite::resize(uint width, uint height){ if(_created == false){ logln("Sprite not cretaed"); } + return *this; } -/* TODO: - * when compiled without 'build_flags = -w' option the following error is issued: - * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::setTransparent(bool)': - * lib\CircuitOS\src\Display\Sprite.cpp:221:1: error: no return statement in function returning non-void [-Werror=return-type] - * 221 | } - * | ^ -*/ Sprite& Sprite::setTransparent(bool transparent){ chroma = transparent; + return *this; } -/* TODO: - * when compiled without 'build_flags = -w' option the following error is issued: - * - * lib\CircuitOS\src\Display\Sprite.cpp: In member function 'Sprite& Sprite::setChroma(Color)': - * lib\CircuitOS\src\Display\Sprite.cpp:226:1: error: no return statement in function returning non-void [-Werror=return-type] - * 226 | } - * | ^ -*/ Sprite& Sprite::setChroma(Color color){ chromaKey = color; chroma = true; + return *this; } void Sprite::pushData(uint width, uint height, uint16_t* data){ From 71fd150077e5db3743a877960b0f4d3b8ac192df Mon Sep 17 00:00:00 2001 From: G-o-T-o <89156641+G-o-T-o@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:45:07 +0200 Subject: [PATCH 3/4] Missing return values in two methods Missing return values in two methods: 1) UI\LowRamScreen.impl: virtual Screen& Screen::addChild(Element*) 2) UI\ScrollLayout.cpp: virtual ElementContainer& ScrollLayout::addChild(Element*) --- src/UI/LowRamScreen.impl | 9 +++++++++ src/UI/ScrollLayout.cpp | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/UI/LowRamScreen.impl b/src/UI/LowRamScreen.impl index 0a12a7e..74ac3e0 100644 --- a/src/UI/LowRamScreen.impl +++ b/src/UI/LowRamScreen.impl @@ -9,6 +9,15 @@ Screen::Screen(Display& display, uint width, uint height) : display(&display), w sprite.cleanup(); } +/* TODO: + * missing return value: + * + * In file included from lib\CircuitOS\src\UI\Screen.cpp:4: + * lib\CircuitOS\src\UI\LowRamScreen.impl: In member function 'virtual Screen& Screen::addChild(Element*)': + * lib\CircuitOS\src\UI\LowRamScreen.impl:20:1: error: no return statement in function returning non-void [-Werror=return-type] + * 20 | } + * | ^ +*/ Screen& Screen::addChild(Element* element){ if(element == nullptr){ children.clear(); diff --git a/src/UI/ScrollLayout.cpp b/src/UI/ScrollLayout.cpp index 24d8a50..8afcfb2 100644 --- a/src/UI/ScrollLayout.cpp +++ b/src/UI/ScrollLayout.cpp @@ -27,6 +27,14 @@ void ScrollLayout::draw(){ Element::draw(); } +/* TODO: + * missing return value: + * + * lib\CircuitOS\src\UI\ScrollLayout.cpp: In member function 'virtual ElementContainer& ScrollLayout::addChild(Element*)': + * lib\CircuitOS\src\UI\ScrollLayout.cpp:38:1: error: no return statement in function returning non-void [-Werror=return-type] + * 38 | } + * | ^ +*/ ElementContainer& ScrollLayout::addChild(Element* element){ if(element == nullptr){ children.clear(); From 383bd4794b4f3f55f8249d602f1f7bd10b336a84 Mon Sep 17 00:00:00 2001 From: G-o-T-o <89156641+G-o-T-o@users.noreply.github.com> Date: Mon, 30 Aug 2021 04:54:25 +0200 Subject: [PATCH 4/4] Added missing return values to methods that expect one Added missing return values to: 1) src/UI/ScrollLayout.cpp: ElementContainer& ScrollLayout::addChild(Element* element) 2) src/UI/LowRamScreen.impl: Screen& Screen::addChild(Element* element) --- src/UI/LowRamScreen.impl | 10 +--------- src/UI/ScrollLayout.cpp | 9 +-------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/UI/LowRamScreen.impl b/src/UI/LowRamScreen.impl index 74ac3e0..ad0e2f9 100644 --- a/src/UI/LowRamScreen.impl +++ b/src/UI/LowRamScreen.impl @@ -9,15 +9,6 @@ Screen::Screen(Display& display, uint width, uint height) : display(&display), w sprite.cleanup(); } -/* TODO: - * missing return value: - * - * In file included from lib\CircuitOS\src\UI\Screen.cpp:4: - * lib\CircuitOS\src\UI\LowRamScreen.impl: In member function 'virtual Screen& Screen::addChild(Element*)': - * lib\CircuitOS\src\UI\LowRamScreen.impl:20:1: error: no return statement in function returning non-void [-Werror=return-type] - * 20 | } - * | ^ -*/ Screen& Screen::addChild(Element* element){ if(element == nullptr){ children.clear(); @@ -26,6 +17,7 @@ Screen& Screen::addChild(Element* element){ }else{ children[0] = element; } + return *this; } void Screen::draw(){ diff --git a/src/UI/ScrollLayout.cpp b/src/UI/ScrollLayout.cpp index 8afcfb2..d6d53cb 100644 --- a/src/UI/ScrollLayout.cpp +++ b/src/UI/ScrollLayout.cpp @@ -27,14 +27,6 @@ void ScrollLayout::draw(){ Element::draw(); } -/* TODO: - * missing return value: - * - * lib\CircuitOS\src\UI\ScrollLayout.cpp: In member function 'virtual ElementContainer& ScrollLayout::addChild(Element*)': - * lib\CircuitOS\src\UI\ScrollLayout.cpp:38:1: error: no return statement in function returning non-void [-Werror=return-type] - * 38 | } - * | ^ -*/ ElementContainer& ScrollLayout::addChild(Element* element){ if(element == nullptr){ children.clear(); @@ -43,6 +35,7 @@ ElementContainer& ScrollLayout::addChild(Element* element){ }else{ children[0] = element; } + return *this; } void ScrollLayout::setScroll(uint scrollX, uint scrollY){