diff options
author | Balint Reczey <balint@balintreczey.hu> | 2016-06-14 22:29:34 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-06-16 04:02:43 +0000 |
commit | f749a64280051663f04fa5dfd11a50e3d4ce4e77 (patch) | |
tree | 377d601807c970203e827ae40be7beb8bf6923d9 /cmake/TestLargeFiles.c.cmakein | |
parent | 4962ea601f6ee08a4f774750dc37bac2fd92c2ca (diff) |
cmake: Detect proper large file defines even with -Wno-error
Without this change large file support was detected as available
even when it was not without additional flags on 32 architectures.
As a result mergecap and other programs are built without large
file support causing mergecap not being able to write files
bigger than 2GB on i386 systems. This used to work properly
with autotools builds, but not with CMake ones.
Change-Id: Ibfd043342b2a48310d2ac9d760e6404a701c5808
Reviewed-on: https://code.wireshark.org/review/15937
Petri-Dish: Balint Reczey <balint@balintreczey.hu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Diffstat (limited to 'cmake/TestLargeFiles.c.cmakein')
-rw-r--r-- | cmake/TestLargeFiles.c.cmakein | 15 |
1 files changed, 12 insertions, 3 deletions
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 <sys/types.h> #include <stdio.h> #include <stdlib.h> @@ -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); |