diff --git a/cmake/TestFileOffsetBits.c b/cmake/TestFileOffsetBits.c index ac0e51e225..882abb4cfc 100644 --- a/cmake/TestFileOffsetBits.c +++ b/cmake/TestFileOffsetBits.c @@ -8,11 +8,17 @@ #include +/* detect failure even with -Wno-error on command line */ +#pragma GCC diagnostic error "-Werror" + int main(int argc, char **argv) { /* Cause a compile-time error if off_t is smaller than 64 bits */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ]; + /* silence unused errors */ + (void)off_t_is_large; + (void)argc; + (void)argv; return 0; } - diff --git a/cmake/TestLargeFiles.c.cmakein b/cmake/TestLargeFiles.c.cmakein index 0ccd1b54b3..2dcf0f3a9b 100644 --- a/cmake/TestLargeFiles.c.cmakein +++ b/cmake/TestLargeFiles.c.cmakein @@ -10,6 +10,9 @@ #cmakedefine _LARGE_FILES #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ +/* detect failure even with -Wno-error on command line */ +#pragma GCC diagnostic error "-Werror" + #include #include #include @@ -20,9 +23,15 @@ int main(int argc, char **argv) * and make sure we have ftello / fseeko. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ]; - FILE *fp = fopen(argv[0],"r"); - off_t offset = ftello( fp ); + int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ]; + /* silence unused warnings */ + FILE *fp; + off_t offset; + (void)off_t_is_large; + (void)argc; + (void)argv; + fp = fopen(argv[0],"r"); + offset = ftello( fp ); fseeko( fp, offset, SEEK_CUR ); fclose(fp);