MikeMirzayanov/testlib

Compilation produces warning

Closed this issue · 3 comments

testlib/testlib.h

Line 3485 in a6e57ad

InStream::readWords(int size, const pattern &p, const std::string &variablesName, int indexBase) {

Here compilation produces warning of unreachable code and missing return.
It's caused by return inside macro. Probably, it's a bug, and it should be ordered differently.

My gcc 10.31. treats this warnings as errors, so I can't compile my checkers locally at all

$ g++ generator_masks_01.cpp 
In file included from generator_masks_01.cpp:1:
testlib.h: In member function ‘std::vector<std::__cxx11::basic_string<char> > InStream::readWords(int, const string&, const string&, int)’:
testlib.h:3505:1: error: control reaches end of non-void function [-Werror=return-type]
 3505 | }
      | ^
testlib.h: In member function ‘std::vector<std::__cxx11::basic_string<char> > InStream::readTokens(int, const string&, const string&, int)’:
testlib.h:3532:1: error: control reaches end of non-void function [-Werror=return-type]
 3532 | }
      | ^
testlib.h: In member function ‘std::vector<std::__cxx11::basic_string<char> > InStream::readStrings(int, const string&, const string&, int)’:
testlib.h:4341:1: error: control reaches end of non-void function [-Werror=return-type]
 4341 | }
      | ^
testlib.h: In member function ‘std::vector<std::__cxx11::basic_string<char> > InStream::readLines(int, const string&, const string&, int)’:
testlib.h:4384:1: error: control reaches end of non-void function [-Werror=return-type]
 4384 | }
      | ^
cc1plus: some warnings being treated as errors

It looks like warning only happens with -O0, with -O1 and more there is no warning

  1. Fixed here #213
  2. Compilation in tests now uses -O0 or similar