From 26547d3e3be403047445fd39e671d7ef3b88dabb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 29 Oct 2020 23:30:42 -0400 Subject: General: Make ignoring a discarded return value an error Allows our CI to catch more potential bugs. This also removes the [[nodiscard]] attribute of IOFile's Open member function. There are cases where a file may want to be opened, but have the status of it checked at a later time. --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71efbb40d..29c6ffc67 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,7 +32,6 @@ if (MSVC) # /Zc:inline - Let codegen omit inline functions in object files # /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null add_compile_options( - /W3 /MP /Zi /Zo @@ -43,6 +42,10 @@ if (MSVC) /Zc:externConstexpr /Zc:inline /Zc:throwingNew + + # Warnings + /W3 + /we4834 # Discarding return value of function with 'nodiscard' attribute ) # /GS- - No stack buffer overflow checks @@ -56,6 +59,7 @@ else() -Werror=implicit-fallthrough -Werror=missing-declarations -Werror=reorder + -Werror=unused-result -Wextra -Wmissing-declarations -Wno-attributes -- cgit v1.2.3 From 11d0a6e7b8a31cb266b56f4f2689824d242adfbf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 29 Oct 2020 23:36:44 -0400 Subject: General: Catch more expressions with no effect on MSVC MSVC lets us fine-tune catching expressions with no side-effects a little more. --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29c6ffc67..030cce92c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,6 +45,10 @@ if (MSVC) # Warnings /W3 + /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect + /we4548 # Expression before comma has no effect; expected expression with side-effect + /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? + /we4555 # Expression has no effect; expected expression with side-effect /we4834 # Discarding return value of function with 'nodiscard' attribute ) -- cgit v1.2.3 From 14a97d082e996a22ff8aa7b57c3ed6fe5912b9cf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Oct 2020 14:57:54 -0400 Subject: CMakeLists: Resolve MSVC build failures Prevents the compiler tripping up about Windows headers. --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 030cce92c..dbda528ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,6 @@ if (MSVC) # Warnings /W3 /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect - /we4548 # Expression before comma has no effect; expected expression with side-effect /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? /we4555 # Expression has no effect; expected expression with side-effect /we4834 # Discarding return value of function with 'nodiscard' attribute -- cgit v1.2.3 From 32f3b6b8658f8eff5e2d0eb312811207a0db0b9f Mon Sep 17 00:00:00 2001 From: comex Date: Mon, 23 Nov 2020 17:24:37 -0500 Subject: CMakeLists: disable -Winvalid-offsetof This Clang warning complains when offsetof is used on a non-standard-layout type (i.e. any class using various C++ features), even though it works fine (and is not undefined behavior as of C++17). --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbda528ce..a22b564d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,6 +66,7 @@ else() -Wextra -Wmissing-declarations -Wno-attributes + -Wno-invalid-offsetof -Wno-unused-parameter ) -- cgit v1.2.3 From ac2e2ebe97964d5eddeb405d48ba61525660e2c1 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 30 Dec 2020 02:58:58 -0300 Subject: cmake: Enforce -Wuninitialized --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a22b564d6..8777df751 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,6 +62,7 @@ else() -Werror=implicit-fallthrough -Werror=missing-declarations -Werror=reorder + -Werror=uninitialized -Werror=unused-result -Wextra -Wmissing-declarations -- cgit v1.2.3 From d7128845c95353f0a4d1518ac7c1d32060d7957b Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 9 Jan 2021 00:21:53 -0300 Subject: cmake: Enforce C4062, C4265, C4388, and C5038 This should match some warnings we treat as errors on gcc and clang, caching bugs early and reducing the number of instances where we have to edit commits to make CI happy when developing from Windows. --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8777df751..daf251d19 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,10 +45,14 @@ if (MSVC) # Warnings /W3 + /we4062 # enumerator 'identifier' in a switch of enum 'enumeration' is not handled + /we4265 # 'class': class has virtual functions, but destructor is not virtual + /we4388 # signed/unsigned mismatch /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? /we4555 # Expression has no effect; expected expression with side-effect /we4834 # Discarding return value of function with 'nodiscard' attribute + /we5038 # data member 'member1' will be initialized after data member 'member2' ) # /GS- - No stack buffer overflow checks -- cgit v1.2.3 From 25724898d081c1cef2876eaf6af4e120fa968f6a Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 10 Jan 2021 01:16:25 -0500 Subject: cmake: Enforce C4101 This matches GCC's -Wunused-variable --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index daf251d19..61adbef28 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,7 @@ if (MSVC) # Warnings /W3 /we4062 # enumerator 'identifier' in a switch of enum 'enumeration' is not handled + /we4101 # 'identifier': unreferenced local variable /we4265 # 'class': class has virtual functions, but destructor is not virtual /we4388 # signed/unsigned mismatch /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect -- cgit v1.2.3