Use pragmas to fix warnings

This commit is contained in:
Laurent Rineau 2014-04-10 19:58:14 +02:00
parent eca3673069
commit cf5d6e041e
6 changed files with 68 additions and 7 deletions

View File

@ -313,11 +313,17 @@ using std::max;
#ifndef __has_builtin
#define __has_builtin(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_warning
#define __has_warning(x) 0 // Compatibility with non-clang compilers.
#endif
// Macro to trigger deprecation warnings
#ifdef CGAL_NO_DEPRECATION_WARNINGS
# define CGAL_DEPRECATED
#elif defined(__GNUC__)
#elif defined(__GNUC__) || __has_attribute(__deprecated__)
# define CGAL_DEPRECATED __attribute__((__deprecated__))
#elif defined (_MSC_VER) && (_MSC_VER > 1300)
# define CGAL_DEPRECATED __declspec(deprecated)
@ -327,14 +333,14 @@ using std::max;
// Macro to specify a 'noreturn' attribute.
#ifdef __GNUG__
#if defined(__GNUG__) || __has_attribute(__noreturn__)
# define CGAL_NORETURN __attribute__ ((__noreturn__))
#else
# define CGAL_NORETURN
#endif
// Macro to specify a 'unused' attribute.
#ifdef __GNUG__
#if defined(__GNUG__) || __has_attribute(__unused__)
# define CGAL_UNUSED __attribute__ ((__unused__))
#else
# define CGAL_UNUSED
@ -361,6 +367,14 @@ using std::max;
# endif
#endif
// Helper macros to disable macros
#if defined(__clang__) || (BOOST_GCC >= 40600)
# define CGAL_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
# define CGAL_PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
#else
# define CGAL_PRAGMA_DIAG_PUSH
# define CGAL_PRAGMA_DIAG_POP
#endif
namespace CGAL {

View File

@ -20,8 +20,6 @@
#ifndef CGAL_MESH_3_CONFIG_H
#define CGAL_MESH_3_CONFIG_H 1
#include <CGAL/Mesh_3/config.h>
#include <CGAL/config.h>
//#define CGAL_MESH_3_VERBOSE 1
@ -64,4 +62,21 @@
# endif
#endif
#if defined(__clang__) || (BOOST_GCC >= 40600)
# define CGAL_MESH_3_IGNORE_UNUSED_VARIABLES \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
#else
# define CGAL_MESH_3_IGNORE_UNUSED_VARIABLES
#endif
#if __has_warning("-Wunneeded-internal-declaration")
# define CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION \
_Pragma("clang diagnostic ignored \"-Wunneeded-internal-declaration\"")
#else
# define CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION
#endif
#define CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS \
CGAL_MESH_3_IGNORE_UNUSED_VARIABLES \
CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION
#endif // CGAL_MESH_3_CONFIG_H

View File

@ -55,7 +55,12 @@ private:
{ Class(double d) : Base<double>(d) { precondition(d); } }; \
inline Class function(double d) { return Class(d); }
BOOST_PARAMETER_NAME( c3t3 )
// see <CGAL/config.h>
CGAL_PRAGMA_DIAG_PUSH
// see <CGAL/Mesh_3/config.h>
CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
BOOST_PARAMETER_NAME( c3t3 );
BOOST_PARAMETER_NAME( domain )
BOOST_PARAMETER_NAME( criteria )
@ -75,6 +80,7 @@ BOOST_PARAMETER_NAME( (dump_after_glob_opt_prefix, tag ) dump_after_glob_opt_pre
BOOST_PARAMETER_NAME( (dump_after_perturb_prefix, tag ) dump_after_perturb_prefix_)
BOOST_PARAMETER_NAME( (dump_after_exude_prefix, tag ) dump_after_exude_prefix_)
CGAL_PRAGMA_DIAG_POP
} // end namespace parameters

View File

@ -27,6 +27,7 @@
#ifndef CGAL_MESH_CRITERIA_3_H
#define CGAL_MESH_CRITERIA_3_H
#include <CGAL/Mesh_3/config.h>
#include <CGAL/Mesh_3/global_parameters.h>
#include <CGAL/Mesh_edge_criteria_3.h>
#include <CGAL/Mesh_facet_criteria_3.h>
@ -35,6 +36,12 @@
namespace CGAL {
namespace parameters {
// see <CGAL/config.h>
CGAL_PRAGMA_DIAG_PUSH
// see <CGAL/Mesh_3/config.h>
CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
BOOST_PARAMETER_NAME( (edge_size, tag) edge_size_ )
BOOST_PARAMETER_NAME( (edge_sizing_field, tag) edge_sizing_field_ )
BOOST_PARAMETER_NAME( (facet_angle, tag) facet_angle_ )
@ -47,6 +54,9 @@ namespace parameters {
BOOST_PARAMETER_NAME( (cell_size, tag) cell_size_ )
BOOST_PARAMETER_NAME( (cell_sizing_field, tag) cell_sizing_field_ )
BOOST_PARAMETER_NAME( (sizing_field, tag) sizing_field_ )
CGAL_PRAGMA_DIAG_POP
} // end namespace parameters
namespace internal {

View File

@ -25,6 +25,7 @@
#ifndef CGAL_MAKE_MESH_3_H
#define CGAL_MAKE_MESH_3_H
#include <CGAL/Mesh_3/config.h>
#include <CGAL/Mesh_3/global_parameters.h>
#include <CGAL/refine_mesh_3.h>
#include <CGAL/tags.h>
@ -113,8 +114,16 @@ namespace parameters {
// -----------------------------------
// Parameters
// -----------------------------------
// see <CGAL/config.h>
CGAL_PRAGMA_DIAG_PUSH
// see <CGAL/Mesh_3/config.h>
CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
BOOST_PARAMETER_NAME( features_param )
CGAL_PRAGMA_DIAG_POP
} // end namespace parameters::internal

View File

@ -26,6 +26,7 @@
#define CGAL_REFINE_MESH_3_H
#include <CGAL/config.h>
#include <CGAL/Mesh_3/config.h>
#include <CGAL/Mesh_3/Dump_c3t3.h>
#include <CGAL/Mesh_3/global_parameters.h>
#include <CGAL/Mesh_3/Mesher_3.h>
@ -314,6 +315,11 @@ namespace parameters {
CGAL_MESH_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3)
// CGAL_MESH_BOOLEAN_PARAMETER defined in <CGAL/Mesh_3/global_parameters.h>
// see <CGAL/config.h>
CGAL_PRAGMA_DIAG_PUSH
// see <CGAL/Mesh_3/config.h>
CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
// -----------------------------------
// Parameters
// -----------------------------------
@ -324,6 +330,7 @@ namespace parameters {
BOOST_PARAMETER_NAME( reset_param )
BOOST_PARAMETER_NAME( mesh_options_param )
CGAL_PRAGMA_DIAG_POP
} // end namespace parameters