Browse Source

A: those aren't enums, B: enable warnings

Lucien Greathouse 1 year ago
parent
commit
5191f7f070
3 changed files with 10 additions and 6 deletions
  1. 6 0
      CMakeLists.txt
  2. 2 5
      JoltC/Enums.h
  3. 2 1
      JoltC/Test.cpp

+ 6 - 0
CMakeLists.txt

@@ -18,6 +18,12 @@ target_compile_features(joltc PUBLIC cxx_std_17)
 target_include_directories(joltc PUBLIC . JoltPhysics)
 target_link_libraries(joltc PUBLIC Jolt)
 
+if(MSVC)
+  target_compile_options(joltc PRIVATE /W4 /WX)
+else()
+  target_compile_options(joltc PRIVATE -Wall -Wextra -Wpedantic -Werror)
+endif()
+
 add_executable(HelloWorld
     HelloWorld/main.cpp
 )

+ 2 - 5
JoltC/Enums.h

@@ -9,11 +9,8 @@
     #define ENSURE_FIELD(a, b, c, d)
 #endif
 
-// JPC_JobSystem_Create()
-enum JPC_JobSystemConstants {
-    JPC_MAX_PHYSICS_JOBS     = 2048,
-    JPC_MAX_PHYSICS_BARRIERS = 8
-};
+const int JPC_MAX_PHYSICS_JOBS = 2048;
+const int JPC_MAX_PHYSICS_BARRIERS = 8;
 
 ENSURE_EQUAL(JPC_MAX_PHYSICS_JOBS, JPH::cMaxPhysicsJobs);
 ENSURE_EQUAL(JPC_MAX_PHYSICS_BARRIERS, JPH::cMaxPhysicsBarriers);

+ 2 - 1
JoltC/Test.cpp

@@ -26,7 +26,8 @@ constexpr auto to_integral(E e) -> typename std::underlying_type<E>::type
 #define ENSURE_TESTS
 
 #define ENSURE_EQUAL(c_const, cpp_const) \
-    static_assert(c_const == cpp_const, #c_const " did not match " #cpp_const);
+    static_assert(c_const == cpp_const, #c_const " did not match " #cpp_const); \
+    static_assert(std::is_same_v<decltype(c_const), decltype(cpp_const)>, "type of " #c_const " did not match type of " #cpp_const);
 
 #define ENSURE_ENUM_EQ(c_const, cpp_enum) \
     static_assert(c_const == to_integral(cpp_enum), #c_const " did not match " #cpp_enum); \