From: Daniel Arndt Date: Sun, 22 Jul 2018 13:04:08 +0000 (+0200) Subject: Avoid #warning using MSVC X-Git-Tag: v9.1.0-rc1~898^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e55c85892995e723eed791bc1f2d880bbf6084fd;p=dealii.git Avoid #warning using MSVC --- diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 717ca8b897..55b34ca6fd 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -382,6 +382,15 @@ _Pragma("GCC diagnostic pop") #endif +/*********************************************************************** + * Define a portable preprocessor macro that generates custom warnings + * reporting the line and the file where the warning appears. Taken from: + * http://goodliffe.blogspot.com/2009/07/c-how-to-say-warning-to-visual-studio-c.html + */ + +#define STRINGIZE_HELPER(x) #x +#define STRINGIZE(x) STRINGIZE_HELPER(x) +#define WARNING(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc) /*********************************************************************** * Final inclusions: diff --git a/include/deal.II/base/sacado_product_type.h b/include/deal.II/base/sacado_product_type.h index 379d02a983..37cd154cee 100644 --- a/include/deal.II/base/sacado_product_type.h +++ b/include/deal.II/base/sacado_product_type.h @@ -1,6 +1,10 @@ #ifndef dealii_sacado_product_type_h_deprecated #define dealii_sacado_product_type_h_deprecated -#warning This file is deprecated. Use instead. + +#include + +#pragma WARNING( \ + "This file is deprecated. Use instead.") #include diff --git a/include/deal.II/dofs/function_map.h b/include/deal.II/dofs/function_map.h index acc9b88154..a26736aaac 100644 --- a/include/deal.II/dofs/function_map.h +++ b/include/deal.II/dofs/function_map.h @@ -20,6 +20,6 @@ #include -#warning "This file is deprecated." +#pragma WARNING("This file is deprecated.") #endif diff --git a/include/deal.II/grid/tria_boundary.h b/include/deal.II/grid/tria_boundary.h index 461aef2f15..86da9ecd77 100644 --- a/include/deal.II/grid/tria_boundary.h +++ b/include/deal.II/grid/tria_boundary.h @@ -18,6 +18,6 @@ #include -#warning This file is deprecated. Use the Manifold classes instead. +#pragma WARNING("This file is deprecated. Use the Manifold classes instead.") #endif diff --git a/include/deal.II/grid/tria_boundary_lib.h b/include/deal.II/grid/tria_boundary_lib.h index 3a227f4c9c..60d585e694 100644 --- a/include/deal.II/grid/tria_boundary_lib.h +++ b/include/deal.II/grid/tria_boundary_lib.h @@ -18,6 +18,6 @@ #include -#warning This file is deprecated. Use the Manifold classes instead. +#pragma WARNING("This file is deprecated.Use the Manifold classes instead.") #endif diff --git a/include/deal.II/lac/constraint_matrix.h b/include/deal.II/lac/constraint_matrix.h index 6a8460de93..d57abd5d90 100644 --- a/include/deal.II/lac/constraint_matrix.h +++ b/include/deal.II/lac/constraint_matrix.h @@ -17,7 +17,8 @@ #ifndef dealii_constraint_matrix_h #define dealii_constraint_matrix_h -#warning This file is deprecated. Use instead. +#pragma WARNING( \ + "This file is deprecated. Use instead.") #include diff --git a/include/deal.II/lac/parallel_block_vector.h b/include/deal.II/lac/parallel_block_vector.h index 93fd5fb8d5..e5dbd0236c 100644 --- a/include/deal.II/lac/parallel_block_vector.h +++ b/include/deal.II/lac/parallel_block_vector.h @@ -20,7 +20,8 @@ #include -#warning This file is deprecated. Use and LinearAlgebra::distributed::BlockVector instead. +#pragma WARNING( \ + "This file is deprecated. Use and LinearAlgebra::distributed::BlockVector instead.") #include #include diff --git a/include/deal.II/lac/parallel_vector.h b/include/deal.II/lac/parallel_vector.h index 016778398d..5acba3abf5 100644 --- a/include/deal.II/lac/parallel_vector.h +++ b/include/deal.II/lac/parallel_vector.h @@ -20,7 +20,8 @@ #include -#warning This file is deprecated. Use and LinearAlgebra::distributed::Vector instead. +#pragma WARNING( \ + "This file is deprecated. Use and LinearAlgebra::distributed::Vector instead.") #include #include diff --git a/source/base/timer.cc b/source/base/timer.cc index 3de8a76218..3bea9c94ca 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -127,7 +127,7 @@ CPUClock::now() noexcept getrusage(RUSAGE_SELF, &usage); system_cpu_duration = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; #else -# warning "Unsupported platform. Porting not finished." +# pragma WARNING("Unsupported platform. Porting not finished.") #endif return time_point( internal::TimerImplementation::from_seconds(system_cpu_duration));