Commit a5cee757 authored by Chuck Atkins's avatar Chuck Atkins

HDF5: Fix build errors for PGI on Linux

Most of the compiler flags set for HDF5 when not using
MSVC are actually GCC specific.  This removes that underlying
assumption and makes the check for GCC explicit.

Change-Id: Ifc9d45ad09435144dc5a44dafb8d16f0b3fd9ba1
parent 8ce63bdc
......@@ -392,9 +392,9 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
endif (HDF5_ENABLE_INSTRUMENT)
mark_as_advanced (HDF5_Enable_Instrument)
#-- NMake Makefiles will overwhelm the console with warnings if -Wall is used.
if (NOT WIN32)
if (NOT WIN32 AND CMAKE_COMPILER_IS_GNUCC)
add_definitions (-Wall)
endif (NOT WIN32)
endif ()
else (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions (-DNDEBUG)
option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF)
......@@ -474,12 +474,11 @@ endif (HDF5_DISABLE_COMPILER_WARNINGS)
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
if (NOT MSVC)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline")
else (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP")
endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
if (CMAKE_C_COMPILER_ID MATCHES "SunPro")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP")
elseif (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline")
# Append warning flags
# Don't use the '-Wtraditional' flag, we're way past having K&R C code
# set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional")
......@@ -537,7 +536,7 @@ if (NOT MSVC)
# Append more extra warning flags that only gcc 4.7+ know about
set (H5_CFLAGS5 "${H5_CFLAGS5} -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn")
endif (NOT MSVC)
endif ()
#-----------------------------------------------------------------------------
# Option to allow the user to enable all warnings
......@@ -550,9 +549,9 @@ if (HDF5_ENABLE_ALL_WARNINGS)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall")
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall")
else (MSVC)
elseif (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}")
endif (MSVC)
endif ()
endif (HDF5_ENABLE_ALL_WARNINGS)
#-----------------------------------------------------------------------------
......@@ -566,9 +565,9 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1")
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1")
else (MSVC)
elseif (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic")
endif (MSVC)
endif ()
endif (HDF5_ENABLE_GROUPZERO_WARNINGS)
#-----------------------------------------------------------------------------
......
......@@ -38,20 +38,18 @@ typedef enum H5PL_type_t {
#ifdef H5_BUILT_AS_DYNAMIC_LIB
#if defined (hdf5_EXPORTS)
/* hdf5 library imports from plugin */
#if defined (_MSC_VER) /* MSVC Compiler Case */
#if defined (_MSC_VER) /* MSVC Compiler Case */
#if defined (hdf5_EXPORTS)
/* hdf5 library imports from plugin */
#define H5PLUGIN_DLL __declspec(dllimport)
#elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */
#define H5PLUGIN_DLL __attribute__ ((visibility("default")))
#endif
#else
/* plugins always export */
#if defined (_MSC_VER) /* MSVC Compiler Case */
#else
/* plugins always export */
#define H5PLUGIN_DLL __declspec(dllexport)
#elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */
#define H5PLUGIN_DLL __attribute__ ((visibility("default")))
#endif
#elif defined(__GNUC__) && (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */
#define H5PLUGIN_DLL __attribute__ ((visibility("default")))
#else /* Everything else */
#define H5PLUGIN_DLL
#endif
#elif defined(H5_BUILT_AS_STATIC_LIB)
......
......@@ -73,7 +73,7 @@ static const char *FileHeader = "\n\
#define H5JMP_BUF sigjmp_buf
#define H5SETJMP(buf) HDsigsetjmp(buf, 1)
#define H5LONGJMP(buf, val) HDsiglongjmp(buf, val)
#define H5HAVE_SIGJMP # sigsetjmp/siglongjmp are supported.
#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */
#elif defined(H5_HAVE_LONGJMP)
#define H5JMP_BUF jmp_buf
#define H5SETJMP(buf) HDsetjmp(buf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment