From 21b3b166bc425843d7e6f004bd4b393d3a47d69d Mon Sep 17 00:00:00 2001 From: cvvergara Date: Fri, 11 Dec 2020 20:13:21 -0600 Subject: [PATCH] removing warnings from postgres & from boost --- CMakeLists.txt | 25 ++++----- include/c_common/arrays_input.h | 38 +------------ include/c_common/postgres_connection.h | 74 +------------------------- include/cpp_common/interruption.h | 33 ------------ src/common/arrays_input.c | 13 +---- src/common/get_check_data.c | 2 +- 6 files changed, 19 insertions(+), 166 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08c920d66bc..ea576e17df7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,11 +208,11 @@ if("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}") endif("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}") #------- -include_directories(${POSTGRESQL_INCLUDE_DIR}) +include_directories(SYSTEM ${POSTGRESQL_INCLUDE_DIR}) if(WIN32) - include_directories(${POSTGRESQL_INCLUDE_DIR}/port/win32) + include_directories(SYSTEM ${POSTGRESQL_INCLUDE_DIR}/port/win32) if(MSVC) - include_directories(${POSTGRESQL_INCLUDE_DIR}/port/win32_msvc/) + include_directories(SYSTEM ${POSTGRESQL_INCLUDE_DIR}/port/win32_msvc/) endif(MSVC) endif(WIN32) @@ -227,7 +227,7 @@ message(STATUS "PGSQL_VERSION=${PGSQL_VERSION}") #--------------------------------------------- find_package(Boost ${BOOST_MINIMUM_VERSION}) if(Boost_FOUND) - include_directories(${Boost_INCLUDE_DIRS}) + include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) message(STATUS "Boost headers were found here: ${Boost_INCLUDE_DIRS}") else() message(FATAL_ERROR " Please check your Boost installation ") @@ -377,16 +377,17 @@ if(WIN32 AND MSVC) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - CHECK_C_COMPILER_FLAG("-frounding-math" C_COMPILER_SUPPORTS_ROUNDING_MATH) - CHECK_CXX_COMPILER_FLAG("-frounding-math" CXX_COMPILER_SUPPORTS_ROUNDING_MATH) - if(C_COMPILER_SUPPORTS_ROUNDING_MATH) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -frounding-math ") - endif() - if(CXX_COMPILER_SUPPORTS_ROUNDING_MATH) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frounding-math ") + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + CHECK_C_COMPILER_FLAG("-frounding-math" C_COMPILER_SUPPORTS_ROUNDING_MATH) + CHECK_CXX_COMPILER_FLAG("-frounding-math" CXX_COMPILER_SUPPORTS_ROUNDING_MATH) + if(C_COMPILER_SUPPORTS_ROUNDING_MATH) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -frounding-math ") + endif() + if(CXX_COMPILER_SUPPORTS_ROUNDING_MATH) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frounding-math ") + endif() endif() - # TODO use -Werror when TRSP gets rewritten set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wconversion -Wmissing-prototypes -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion") if(BOOST_Geometry_VERSION_OK) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wconversion -pedantic -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion") diff --git a/include/c_common/arrays_input.h b/include/c_common/arrays_input.h index aff19c3583d..f5677d0e08b 100644 --- a/include/c_common/arrays_input.h +++ b/include/c_common/arrays_input.h @@ -28,44 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include - - -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpedantic" -# pragma clang diagnostic ignored "-Wignored-attributes" -#else -# ifdef __GNUC__ -# if __GNUC__ > 5 -# pragma GCC diagnostic ignored "-Wpedantic" -# else -# pragma GCC diagnostic ignored "-pedantic" -# endif -# endif -#endif - #include - -#ifdef __clang__ -#pragma clang diagnostic pop -#else -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#endif - - -// for ArrayType -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wignored-attributes" -#endif - -#include "utils/array.h" - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif +#include /** @brief enforces the input array to be @b NOT empty */ int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input); diff --git a/include/c_common/postgres_connection.h b/include/c_common/postgres_connection.h index 40e414fba70..177d283dc0e 100644 --- a/include/c_common/postgres_connection.h +++ b/include/c_common/postgres_connection.h @@ -26,83 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #pragma once -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpedantic" -#pragma clang diagnostic ignored "-Wignored-attributes" -#else -#pragma GCC diagnostic ignored "-Wpedantic" -#endif - - -#ifdef __MSVC__ -#pragma warning(disable : 4200) -#endif - #include - - -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wsign-conversion" -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunused-parameter" -# pragma clang diagnostic push -# pragma GCC diagnostic ignored "-Wconversion" - -#else -# ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wsign-conversion" -# pragma GCC diagnostic ignored "-Wconversion" -# pragma GCC diagnostic ignored "-Wunused-parameter" -# endif -#endif - - #include #include - -#ifdef __clang__ -#pragma clang diagnostic pop -#pragma clang diagnostic pop -#pragma clang diagnostic pop -#pragma clang diagnostic pop -#else -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#pragma GCC diagnostic pop -#pragma GCC diagnostic pop -#pragma GCC diagnostic pop -#endif -#endif - - -#include "utils/builtins.h" // for text_to_cstring - -#if PGSQL_VERSION > 92 -#include "access/htup_details.h" -#endif - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" -#else -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif -#endif - +#include // for text_to_cstring +#include #include -#ifdef __clang__ -#pragma clang diagnostic pop -#else -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#endif - - void pgr_send_error(int errcode); void pgr_SPI_finish(void); diff --git a/include/cpp_common/interruption.h b/include/cpp_common/interruption.h index db56b186f3f..c0968614102 100644 --- a/include/cpp_common/interruption.h +++ b/include/cpp_common/interruption.h @@ -26,43 +26,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #ifndef INCLUDE_CPP_COMMON_INTERRUPTION_H_ #define INCLUDE_CPP_COMMON_INTERRUPTION_H_ -/* - * Suppress the -Wpedantic warning temporarily about the postgres file - */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpedantic" -#pragma clang diagnostic ignored "-Wignored-attributes" -#else -#ifdef __GNUC__ -#if __GNUC__ > 5 -#pragma GCC diagnostic ignored "-Wpedantic" -#else -#pragma GCC diagnostic ignored "-pedantic" -#endif -#endif -#endif - -#ifdef __MSVC__ -#pragma warning(disable : 4200) -#endif extern "C" { #include #include } -#ifdef __clang__ -#pragma clang diagnostic pop -#else -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#endif - - -#ifdef __MSVC__ -#pragma warning(default : 4200) -#endif - #endif // INCLUDE_CPP_COMMON_INTERRUPTION_H_ diff --git a/src/common/arrays_input.c b/src/common/arrays_input.c index 9bfd33f0c53..6cab89ae561 100644 --- a/src/common/arrays_input.c +++ b/src/common/arrays_input.c @@ -25,17 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "c_common/arrays_input.h" #include -#include "utils/lsyscache.h" -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wignored-attributes" -#endif -#include "catalog/pg_type.h" - -#ifdef __clang__ -# pragma clang diagnostic pop -#endif - +#include +#include #include "c_common/time_msg.h" #include "c_common/debug_macro.h" diff --git a/src/common/get_check_data.c b/src/common/get_check_data.c index 879eb4da4da..b90b51219cd 100644 --- a/src/common/get_check_data.c +++ b/src/common/get_check_data.c @@ -208,7 +208,7 @@ pgr_SPI_getBigIntArr( */ ArrayType *pg_array = DatumGetArrayTypeP(raw_array); - return (int64_t*) pgr_get_bigIntArray(the_size, pg_array); + return pgr_get_bigIntArray((size_t*)the_size, pg_array); }