From a9031b6bae742b333b1b390192fa590f2ecb07ea Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 5 Oct 2020 11:27:14 +0100 Subject: Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963) * Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang --- src/OSSupport/File.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/OSSupport/File.h') diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h index 62853ede7..59f3a5558 100644 --- a/src/OSSupport/File.h +++ b/src/OSSupport/File.h @@ -192,7 +192,17 @@ class FileStream final : public StreamType { public: - FileStream(const std::string & Path); + FileStream(const std::string & Path) + { + // Except on failbit, which is what open sets on failure: + FileStream::exceptions(FileStream::failbit | FileStream::badbit); + + // Open the file: + FileStream::open(Path); + + // Only subsequently except on serious errors, and not on conditions like EOF or malformed input: + FileStream::exceptions(FileStream::badbit); + } }; -- cgit v1.2.3