Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing warnings from postgres & from boost #1781

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 ")
Expand Down Expand Up @@ -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")
Expand Down
38 changes: 1 addition & 37 deletions include/c_common/arrays_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#include <stdint.h>


#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 <postgres.h>

#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 <utils/array.h>

/** @brief enforces the input array to be @b NOT empty */
int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input);
Expand Down
74 changes: 2 additions & 72 deletions include/c_common/postgres_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <postgres.h>


#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 <executor/spi.h>
#include <funcapi.h>

#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 <utils/builtins.h> // for text_to_cstring
#include <access/htup_details.h>
#include <fmgr.h>

#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);
Expand Down
33 changes: 0 additions & 33 deletions include/cpp_common/interruption.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <postgres.h>
#include <miscadmin.h>
}

#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_
13 changes: 2 additions & 11 deletions src/common/arrays_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "c_common/arrays_input.h"

#include <assert.h>
#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 <utils/lsyscache.h>
#include <catalog/pg_type.h>

#include "c_common/time_msg.h"
#include "c_common/debug_macro.h"
Expand Down
2 changes: 1 addition & 1 deletion src/common/get_check_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down