> > > +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 199901L) && \ > > Did you mean ">= 199901L" here rather than ">"? >
I did, that was a typo. On 08/01/2014 02:22 PM, Chuck Atkins wrote: > > I noticed the recent merge of liblzma broke the PGI compiler. > > It is not surprising that there is lingering C99 code because > the library implementation was ported from C99 to C89/90 for > inclusion in CMake. > Not only that but the line in question was being protected from MSVC, not C99. Given that it was ported though, I'd say the better fix would be to remove the C99 version entirely and always use the C89 version without the static array dimensions. See updated patch.
From 4c33d91f999b9030b4666be2f94d7a86c8da8527 Mon Sep 17 00:00:00 2001 From: Chuck Atkins <chuck.atk...@kitware.com> Date: Fri, 1 Aug 2014 13:56:41 -0400 Subject: [PATCH] Fix broken PGI builds for liblzma. - sha265.c is using some C99 specific features, in particular static array dimensions in a function parameter array (see section 6.7.5-7 of the C99 spec). A #ifndef check was in place to prevent compilation under MSVC but it actually needs to check for C99 compliance instead. Also, even though the PGI C compiler reports to be fully C99 compliant, it still fails. - CHECK_SYMBOL_EXISTS is used to determine the presense of bswap functions from byteswap.h. Most compilers re-dedefine the bswap_N functions as a __bswap_N function implemented by the compiler. Since bswap_N is usually defined as a macro then it's mere presence passes the check. Some versions of the PGI compiler though have shipped broken headers for byteswap.h, in particular 11.3 for x64 linux provides byteswap.h but is missing an associated bits/byteswap.h which causes some of the bswap_N macros to be defined but broken and unusable. The bswap_N checks have been converted to CHECK_SOURCE_COMPILES to ensure that the bswap_N calls are actually usable and not just merely defined. --- Utilities/cmliblzma/CMakeLists.txt | 12 +++++++++--- Utilities/cmliblzma/liblzma/check/sha256.c | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index fc50dbe..856e41e 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -31,9 +31,15 @@ CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H) CHECK_INCLUDE_FILE(string.h HAVE_STRING_H) CHECK_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H) -CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h HAVE_BSWAP_16) -CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h HAVE_BSWAP_32) -CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h HAVE_BSWAP_64) +CHECK_C_SOURCE_COMPILES ( + "#include<byteswap.h>\nint main(void){bswap_16(0);return 0;}" + HAVE_BSWAP_16) +CHECK_C_SOURCE_COMPILES ( + "#include<byteswap.h>\nint main(void){bswap_32(0);return 0;}" + HAVE_BSWAP_32) +CHECK_C_SOURCE_COMPILES ( + "#include<byteswap.h>\nint main(void){bswap_64(0);return 0;}" + HAVE_BSWAP_64) TEST_BIG_ENDIAN(WORDS_BIGENDIAN) diff --git a/Utilities/cmliblzma/liblzma/check/sha256.c b/Utilities/cmliblzma/liblzma/check/sha256.c index b09ccbf..f1d3337 100644 --- a/Utilities/cmliblzma/liblzma/check/sha256.c +++ b/Utilities/cmliblzma/liblzma/check/sha256.c @@ -80,7 +80,9 @@ static const uint32_t SHA256_K[64] = { static void -#ifndef _MSC_VER +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 199901L) && \ + !defined(__PGIC__) +/* Even though "int foo[static 3] is valid C99, the PGI compiler still breaks */ transform(uint32_t state[static 8], const uint32_t data[static 16]) #else transform(uint32_t state[], const uint32_t data[]) -- 1.7.4.1
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers