Repository: lucy-charmonizer Updated Branches: refs/heads/master 4e29a77d0 -> af5da8c9a
Try to link LargeFiles probes C allows calls to undeclared functions, so the LargeFiles probes must check whether the test program can be linked successfully. Fixes macOS build. Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/00ca462e Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/00ca462e Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/00ca462e Branch: refs/heads/master Commit: 00ca462e2f4159a7c79e14edce148ad8e3c4dfcf Parents: 4e29a77 Author: Nick Wellnhofer <[email protected]> Authored: Wed Feb 8 15:13:02 2017 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Wed Feb 8 15:13:02 2017 +0100 ---------------------------------------------------------------------- src/Charmonizer/Probe/LargeFiles.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/00ca462e/src/Charmonizer/Probe/LargeFiles.c ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Probe/LargeFiles.c b/src/Charmonizer/Probe/LargeFiles.c index 5179bb3..57acd1b 100644 --- a/src/Charmonizer/Probe/LargeFiles.c +++ b/src/Charmonizer/Probe/LargeFiles.c @@ -154,10 +154,11 @@ chaz_LargeFiles_try_stdio64(chaz_LargeFiles_stdio64_combo *combo) { CHAZ_QUOTE( %s ) CHAZ_QUOTE( #include <stdio.h> ) CHAZ_QUOTE( int a[sizeof(%s)==8?1:-1]; ) - CHAZ_QUOTE( void f() { ) + CHAZ_QUOTE( int main() { ) CHAZ_QUOTE( FILE *f = %s("_charm_stdio64", "w"); ) CHAZ_QUOTE( %s pos = %s(f); ) CHAZ_QUOTE( %s(f, 0, SEEK_SET); ) + CHAZ_QUOTE( return 0; ) CHAZ_QUOTE( } ); char code_buf[sizeof(stdio64_code) + 200]; @@ -168,7 +169,7 @@ chaz_LargeFiles_try_stdio64(chaz_LargeFiles_stdio64_combo *combo) { combo->fseek_command); /* Verify compilation and that the offset type has 8 bytes. */ - return chaz_CC_test_compile(code_buf); + return chaz_CC_test_link(code_buf); } static void @@ -200,12 +201,15 @@ static int chaz_LargeFiles_probe_lseek(chaz_LargeFiles_unbuff_combo *combo) { static const char lseek_code[] = CHAZ_QUOTE( %s ) - CHAZ_QUOTE( void f() { %s(0, 0, SEEK_SET); } ); + CHAZ_QUOTE( int main() { ) + CHAZ_QUOTE( %s(0, 0, SEEK_SET); ) + CHAZ_QUOTE( return 0; ) + CHAZ_QUOTE( } ); char code_buf[sizeof(lseek_code) + 100]; /* Verify compilation. */ sprintf(code_buf, lseek_code, combo->includes, combo->lseek_command); - return chaz_CC_test_compile(code_buf); + return chaz_CC_test_link(code_buf); } static int @@ -214,15 +218,16 @@ chaz_LargeFiles_probe_pread64(chaz_LargeFiles_unbuff_combo *combo) { * fine as long as it compiles. */ static const char pread64_code[] = CHAZ_QUOTE( %s ) - CHAZ_QUOTE( void f() { ) + CHAZ_QUOTE( int main() { ) CHAZ_QUOTE( char buf[1]; ) CHAZ_QUOTE( %s(0, buf, 1, 1); ) + CHAZ_QUOTE( return 0; ) CHAZ_QUOTE( } ); char code_buf[sizeof(pread64_code) + 100]; /* Verify compilation. */ sprintf(code_buf, pread64_code, combo->includes, combo->pread64_command); - return chaz_CC_test_compile(code_buf); + return chaz_CC_test_link(code_buf); } static void
