thomasrussellmurphy / istyle-verilog-formatter

Open source implementation of a Verilog formatter
GNU General Public License v2.0
173 stars 44 forks source link

[debug] use istream::peek() != EOF to check eof of option-file #10

Closed RPGP1 closed 4 years ago

RPGP1 commented 5 years ago

Because std::istream::operator bool() returns false AFTER FAILING get(), the function importOptions read the final character TWICE. Giving empty file for --options=... told me this error.

In this commit, std::istream::peek() is used instead. This member function returns the next character without proceeding the file pointer, which you can compare to EOF without any side-effects.