chrberger / libcluon

libcluon is a small and efficient, single-file and header-only library written in modern C++ to power microservices.
Mozilla Public License 2.0
101 stars 13 forks source link

Warning from compiler: maybe-uninitialized (Version: 0.0.121) #4

Closed Adam2092 closed 5 years ago

Adam2092 commented 5 years ago

The following warning, treated as error with -Werror flag), was provided by compiler g++ (version 6.4.0-r5) within Alpine 3.7 as docker image builder:

`/opt/sources/src/cluon-complete.hpp: In member function 'virtual size_t peg::CharacterClass::parse(const char*, size_t, peg::SemanticValues&, peg::Context&, peg::any&) const': /opt/sources/src/cluon-complete.hpp:1754:39: error: 'cp' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (range.first <= cp && cp <= range.second) {


cc1plus: all warnings being treated as errors`

I added a pair of parentheses after the declaration of cp in the line 1749, and the compiler was satisfied.
chrberger commented 5 years ago

Fixed with cca5e4c8