ganezdragon/tree-sitter-perl

Build warning: control reaches end of non-void function

Closed this issue · 5 comments

While building with rust, we will meat warnings like:

warning: vendor/tree-sitter-perl-src/scanner.cc: In member function ‘bool {anonymous}::Scanner::handle_escape_sequence(TSLexer*, {anonymous}::TokenType)’:
warning: vendor/tree-sitter-perl-src/scanner.cc:537:5: warning: control reaches end of non-void function [-Wreturn-type]
warning:   537 |     }
warning:       |     ^

Adding a return false looks good to you? I'm glad to send a PR for it.

@Xuanwo , could you tell me what's the step to build using rust? I can quickly check that out.

It can be reproduced by:

:) cc -Werror -I ./src -c src/scanner.cc
src/scanner.cc: In member function ‘bool {anonymous}::Scanner::handle_escape_sequence(TSLexer*, {anonymous}::TokenType)’:
src/scanner.cc:537:5: error: control reaches end of non-void function [-Werror=return-type]
  537 |     }
      |     ^
cc1plus: all warnings being treated as errors

@ganezdragon Hi, any updates on this issue?

@Xuanwo fixed it in the latest commit - c43bae0

Apologies for the delay. Please review this and close the issue as needed.

Thanks a lot!