From cbf3a164710862eda6be6e2febbe3fa86d26bebf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 17 Jan 2018 15:02:32 +0000 Subject: [PATCH] libs compile without warning --- CGAL_Core/include/CGAL/CORE/BigFloat.h | 4 +++ CGAL_Core/include/CGAL/CORE/CoreAux_impl.h | 2 +- CGAL_ImageIO/include/CGAL/ImageIO_impl.h | 2 +- GraphicsView/src/CGAL_Qt5/DemosMainWindow.cpp | 3 ++- .../src/CGAL_Qt5/GraphicsViewNavigation.cpp | 2 ++ .../CGAL_Qt5/GraphicsViewPolylineInput.cpp | 2 ++ GraphicsView/src/CGAL_Qt5/resources.cpp | 2 ++ Installation/include/CGAL/disable_warnings.h | 26 +++++++++++++++++++ Installation/include/CGAL/enable_warnings.h | 24 +++++++++++++++++ .../internal/numeric_solvers_support_impl.h | 1 + .../src/CGAL/JAMA_numeric_solver.cpp | 4 +-- .../src/CGAL/Turkowski_numeric_solver.cpp | 4 +-- .../src/CGAL/numeric_solvers_support.cpp | 4 +-- Number_types/include/CGAL/GMP/Gmpfr_type.h | 9 ++++--- Number_types/include/CGAL/GMP/Gmpq_type.h | 4 +++ Number_types/include/CGAL/Interval_nt.h | 21 ++------------- Number_types/include/CGAL/gmp.h | 6 ++--- .../include/CGAL/Profile_counter.h | 4 +++ .../include/CGAL/IO/File_scanner_OFF.h | 4 +++ Stream_support/include/CGAL/IO/io.h | 3 +++ 20 files changed, 97 insertions(+), 34 deletions(-) create mode 100644 Installation/include/CGAL/disable_warnings.h create mode 100644 Installation/include/CGAL/enable_warnings.h diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat.h b/CGAL_Core/include/CGAL/CORE/BigFloat.h index 3e070c18190..4dc7263dfb1 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat.h @@ -36,6 +36,8 @@ #ifndef _CORE_BIGFLOAT_H_ #define _CORE_BIGFLOAT_H_ +#include + #include #include @@ -633,4 +635,6 @@ inline BigRat::BigRat(const BigFloat& f) : RCBigRat(new BigRatRep()){ #include #endif // CGAL_HEADER_ONLY +#include + #endif // _CORE_BIGFLOAT_H_ diff --git a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h index 027972559e8..962a037dadf 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h @@ -41,7 +41,7 @@ #endif #include -#include +#include namespace CORE { diff --git a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h index f6ed71278d1..9d57d1470e4 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h @@ -28,7 +28,7 @@ #ifdef _MSC_VER // Suppress deprecated warning for fileno and strdup -# pragma warning(disable:4996) +# pragma warning(disable: 4127 4706 4996) #include #include diff --git a/GraphicsView/src/CGAL_Qt5/DemosMainWindow.cpp b/GraphicsView/src/CGAL_Qt5/DemosMainWindow.cpp index 996cafa3a15..aaa3349c788 100644 --- a/GraphicsView/src/CGAL_Qt5/DemosMainWindow.cpp +++ b/GraphicsView/src/CGAL_Qt5/DemosMainWindow.cpp @@ -22,7 +22,8 @@ #ifndef CGAL_HEADER_ONLY +#include #include #include - +#include #endif // CGAL_HEADER_ONLY diff --git a/GraphicsView/src/CGAL_Qt5/GraphicsViewNavigation.cpp b/GraphicsView/src/CGAL_Qt5/GraphicsViewNavigation.cpp index ba34d9223e2..c5821da1e90 100644 --- a/GraphicsView/src/CGAL_Qt5/GraphicsViewNavigation.cpp +++ b/GraphicsView/src/CGAL_Qt5/GraphicsViewNavigation.cpp @@ -22,7 +22,9 @@ #ifndef CGAL_HEADER_ONLY +#include #include #include +#include #endif // CGAL_HEADER_ONLY diff --git a/GraphicsView/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp b/GraphicsView/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp index 9ea1b7132c8..cd8426acc65 100644 --- a/GraphicsView/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp +++ b/GraphicsView/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp @@ -22,7 +22,9 @@ #ifndef CGAL_HEADER_ONLY +#include #include #include +#include #endif // CGAL_HEADER_ONLY diff --git a/GraphicsView/src/CGAL_Qt5/resources.cpp b/GraphicsView/src/CGAL_Qt5/resources.cpp index 070ac927d15..ba116c00e63 100644 --- a/GraphicsView/src/CGAL_Qt5/resources.cpp +++ b/GraphicsView/src/CGAL_Qt5/resources.cpp @@ -21,7 +21,9 @@ #ifndef CGAL_HEADER_ONLY +#include #include #include +#include #endif // CGAL_HEADER_ONLY diff --git a/Installation/include/CGAL/disable_warnings.h b/Installation/include/CGAL/disable_warnings.h new file mode 100644 index 00000000000..d3db3d201a3 --- /dev/null +++ b/Installation/include/CGAL/disable_warnings.h @@ -0,0 +1,26 @@ +// Copyright (c) 2018 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// Author: Andreas Fabri + +#include + +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +# pragma warning(disable: 4127) // conditional expression is constant +#endif diff --git a/Installation/include/CGAL/enable_warnings.h b/Installation/include/CGAL/enable_warnings.h new file mode 100644 index 00000000000..33e63acfa45 --- /dev/null +++ b/Installation/include/CGAL/enable_warnings.h @@ -0,0 +1,24 @@ +// Copyright (c) 2018 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// Author: Andreas Fabri + +#include + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif diff --git a/Kinetic_data_structures/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h b/Kinetic_data_structures/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h index 5b6456cdc8e..6c3eed12b05 100644 --- a/Kinetic_data_structures/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h +++ b/Kinetic_data_structures/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h @@ -108,6 +108,7 @@ inline void compute_linear_roots_t(const NT *begin, const NT *, NT lb, NT ub, std::vector &roots) { + CGAL_USE(lb); if (CLEAN && begin[1]>0 ) return; //NT max_error=0; //if (CLEAN) max_error=max_error_value; diff --git a/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp b/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp index 25c1ad97bff..3c23bd53beb 100644 --- a/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp +++ b/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp @@ -20,8 +20,8 @@ // Author(s) : Daniel Russel #ifndef CGAL_HEADER_ONLY - +#include #include #include - +#include #endif diff --git a/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp b/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp index aebc54f0548..4ec474989d4 100644 --- a/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp +++ b/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp @@ -20,8 +20,8 @@ // Author(s) : Daniel Russel #ifndef CGAL_HEADER_ONLY - +#include #include #include - +#include #endif diff --git a/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp b/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp index 41612645cb5..48f61df0fb2 100644 --- a/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp +++ b/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp @@ -21,8 +21,8 @@ #ifndef CGAL_HEADER_ONLY - +#include #include #include - +#include #endif diff --git a/Number_types/include/CGAL/GMP/Gmpfr_type.h b/Number_types/include/CGAL/GMP/Gmpfr_type.h index 1c95dbe8e34..fd9e61974cc 100644 --- a/Number_types/include/CGAL/GMP/Gmpfr_type.h +++ b/Number_types/include/CGAL/GMP/Gmpfr_type.h @@ -349,7 +349,10 @@ class Gmpfr: // only avoid the binary incompatibility of a CGAL program compiled // with MSVC with the libmpfr-1.dll compiled with mingw. #ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4244) CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_d); +# pragma warning(pop) #else CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_ld); #endif @@ -1283,17 +1286,17 @@ bool operator==(const Gmpfr &a,double b){ #ifdef _MSC_VER inline bool operator<(const Gmpfr &a,long double b){ - return(mpfr_cmp_d(a.fr(),b)<0); + return(mpfr_cmp_d(a.fr(),static_cast(b))<0); } inline bool operator>(const Gmpfr &a,long double b){ - return(mpfr_cmp_d(a.fr(),b)>0); + return(mpfr_cmp_d(a.fr(),static_cast(b))>0); } inline bool operator==(const Gmpfr &a,long double b){ - return !mpfr_cmp_d(a.fr(),b); + return !mpfr_cmp_d(a.fr(),static_cast(b)); } #else inline diff --git a/Number_types/include/CGAL/GMP/Gmpq_type.h b/Number_types/include/CGAL/GMP/Gmpq_type.h index 3e2db0ccd49..234eb98a0a9 100644 --- a/Number_types/include/CGAL/GMP/Gmpq_type.h +++ b/Number_types/include/CGAL/GMP/Gmpq_type.h @@ -27,6 +27,8 @@ #ifndef CGAL_GMPQ_TYPE_H #define CGAL_GMPQ_TYPE_H +#include + #include #include @@ -513,4 +515,6 @@ inline Gmpq max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpq& x,const Gmpq& y){ # pragma warning(pop) #endif +#include + #endif // CGAL_GMPQ_TYPE_H diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index cb625e06608..98971080a4f 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -464,7 +464,7 @@ std::ostream & operator<< (std::ostream &os, const Interval_nt & I ) #define CGAL_SWALLOW(IS,CHAR) \ { \ char c; \ - do c = is.get(); while (isspace(c)); \ + do is.get(c); while (isspace(c)); \ if (c != CHAR) { \ is.setstate(std::ios_base::failbit); \ } \ @@ -474,7 +474,7 @@ template std::istream & operator>> (std::istream &is, Interval_nt & I) { char c; - do c = is.get(); while (isspace(c)); + do is.get(c); while (isspace(c)); is.putback(c); if(c == '['){ // read original output from operator << double inf,sup; @@ -931,23 +931,6 @@ namespace INTERN_INTERVAL_NT { return Uncertain::indeterminate(); } - // TODO: Whats this for? Why is this in this file?? - inline - std::pair - to_interval (const long & l) - { - if (sizeof(double) > sizeof(long)) { - // On 64bit platforms, a long doesn't fit exactly in a double. - // Well, a perfect fix would be to use std::numeric_limits<>, but... - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - Interval_nt approx (static_cast(l)); - FPU_set_cw(CGAL_FE_UPWARD); - approx += Interval_nt::smallest(); - return approx.pair(); - } - else - return std::pair(static_cast(l),static_cast(l)); - } } // namespace INTERN_INTERVAL_NT diff --git a/Number_types/include/CGAL/gmp.h b/Number_types/include/CGAL/gmp.h index ba23acdff70..9e234c1d2c7 100644 --- a/Number_types/include/CGAL/gmp.h +++ b/Number_types/include/CGAL/gmp.h @@ -21,10 +21,10 @@ #define CGAL_GMP_H 1 #include - +#include #if defined(BOOST_MSVC) # pragma warning(push) -# pragma warning(disable:4244 4146) // conversion with loss of data +# pragma warning(disable: 4127 4244 4146) // conversion with loss of data // warning on - applied on unsigned number #endif @@ -34,5 +34,5 @@ #if defined(BOOST_MSVC) # pragma warning(pop) #endif - +#include #endif // CGAL_GMP_H diff --git a/Profiling_tools/include/CGAL/Profile_counter.h b/Profiling_tools/include/CGAL/Profile_counter.h index a97e889505f..a797d95ea8c 100644 --- a/Profiling_tools/include/CGAL/Profile_counter.h +++ b/Profiling_tools/include/CGAL/Profile_counter.h @@ -58,6 +58,8 @@ #include #include +#include + // Automatically define CGAL_CONCURRENT_PROFILE if we're linked with TBB #ifdef CGAL_LINKED_WITH_TBB # ifndef CGAL_CONCURRENT_PROFILE @@ -256,4 +258,6 @@ private: } //namespace CGAL +#include + #endif // CGAL_PROFILE_COUNTER_H diff --git a/Stream_support/include/CGAL/IO/File_scanner_OFF.h b/Stream_support/include/CGAL/IO/File_scanner_OFF.h index bf7e1b530fd..93197d60ba8 100644 --- a/Stream_support/include/CGAL/IO/File_scanner_OFF.h +++ b/Stream_support/include/CGAL/IO/File_scanner_OFF.h @@ -26,6 +26,8 @@ #ifndef CGAL_IO_FILE_SCANNER_OFF_H #define CGAL_IO_FILE_SCANNER_OFF_H 1 +#include + #include #include #include @@ -699,5 +701,7 @@ file_scan_normal( File_scanner_OFF& scanner, Vector& v) { #include #endif // CGAL_HEADER_ONLY +#include + #endif // CGAL_IO_FILE_SCANNER_OFF_H // // EOF // diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index 0a580d6da31..4a3b6ca3ed2 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -27,6 +27,7 @@ #ifndef CGAL_IO_H #define CGAL_IO_H +#include #include #include @@ -616,4 +617,6 @@ inline void read_float_or_quotient(std::istream& is, Rat &z) #include #endif // CGAL_HEADER_ONLY +#include + #endif // CGAL_IO_H