]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Refactor configuration for MSVC's compiler warning
authorMatthias Maier <tamiko@43-1.org>
Sun, 2 Aug 2015 23:01:28 +0000 (18:01 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 3 Aug 2015 02:39:16 +0000 (21:39 -0500)
Those configuration should go to setup_compiler_flags_msvc.cmake and not
into the config.h header file...

cmake/setup_compiler_flags.cmake
cmake/setup_compiler_flags_msvc.cmake
include/deal.II/base/config.h.in

index ed35485116237915ca5561b5ef7a1ab325de5ad7..3dc72be873de64b72932d6655fdc8618138f1fec 100644 (file)
 #   DEAL_II_LINKER_FLAGS
 #   DEAL_II_LINKER_FLAGS_DEBUG
 #   DEAL_II_LINKER_FLAGS_RELEASE
+#   DEAL_II_DEFINITIONS
+#   DEAL_II_DEFINITIONS_DEBUG
+#   DEAL_II_DEFINITIONS_RELEASE
+#   DEAL_II_USER_DEFINITIONS
+#   DEAL_II_USER_DEFINITIONS_DEBUG
+#   DEAL_II_USER_DEFINITIONS_RELEASE
 #
 # All modifications shall be guarded with the ENABLE_IF_SUPPORTED
 # or ENABLE_IF_LINKS macro, e.g.
index d23b5e455f59347f84ab81dc588664c62440b0b8..bb5b8c45d3ba90a488e86501e252554f4b351ac3 100644 (file)
 # enable exception handling:
 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/EHsc")
 
-#enable warnings:
-ADD_FLAGS(DEAL_II_CXX_FLAGS "/W3")
 
 # Globally disable some legacy min and max macros that cause problems:
 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/NOMINMAX")
+LIST(APPEND DEAL_II_DEFINITIONS "NOMINMAX")
+LIST(APPEND DEAL_II_USER_DEFINITIONS "NOMINMAX")
+
+ADD_FLAGS(DEAL_II_CXX_FLAGS "/W3")
 
-# Disable warning about unknown pragmas
+#
+# Selectively disable a bunch of warnings:
+#
+# 4068 - unknown pragmas
+# 4244 - implied downcasting from double to float
+# 4267 - implied downcasting from size_t to unsigned int
+# 4996 - unsafe functions, such as strcat and sprintf
+# 4355 - 'this' : used in base member initializer list
+# 4661 - no suitable definition provided for explicit template instantiation request
+# 4800 - forcing value to bool 'true' or 'false' (performance warning)
+# 4146 - unary minus operator applied to unsigned type, result still unsigned
+# 4667 - no function template defined that matches forced instantiation
+# 4520 - multiple default constructors specified
+# 4700 - uninitialized local variable
+# 4789 - destination of memory copy is too small
+# 4808 - case 'value' is not a valid value for switch condition of type 'bool
 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4068")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4244")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4267")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4996")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4355")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4661")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4800")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4146")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4667")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4520")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4700")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4789")
+ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/wd4808")
+
 
 #############################
 #                           #
index 09fbfb319ceb746d7e006ebf116f3441a12f6cf3..0d756e943d27ce1d4a47f92c2bb5f4fe9c61c207 100644 (file)
 
 #cmakedefine DEAL_II_MSVC
 
-/*
- * Disable a bunch of warnings for Microsoft Visual C++.
- */
-#ifdef _MSC_VER
-#  pragma warning( disable : 4244 ) /* implied downcasting from double to float */
-#  pragma warning( disable : 4267 ) /* implied downcasting from size_t to unsigned int */
-#  pragma warning( disable : 4996 ) /* unsafe functions, such as strcat and sprintf */
-#  pragma warning( disable : 4355 ) /* 'this' : used in base member initializer list */
-#  pragma warning( disable : 4661 ) /* no suitable definition provided for explicit template instantiation request */
-#  pragma warning( disable : 4800 ) /* forcing value to bool 'true' or 'false' (performance warning) */
-#  pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */
-#  pragma warning( disable : 4667 ) /* no function template defined that matches forced instantiation */
-#  pragma warning( disable : 4520 ) /* multiple default constructors specified */
-#  pragma warning( disable : 4700 ) /* uninitialized local variable */
-#  pragma warning( disable : 4789 ) /* destination of memory copy is too small */
-#  pragma warning( disable : 4808 ) /* case 'value' is not a valid value for switch condition of type 'bool */
-/*
- * Also make sure we don't let MS Windows headers define min/max as
- * macros, see http://support.microsoft.com/kb/143208
- */
-#  define NOMINMAX
-#endif /*_MSC_VER*/
-
 
 /***********************************************************************
  * Thread support

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.