Commit f08eb5cf authored by Leif Walsh's avatar Leif Walsh

Merge pull request #245 from Tokutek/gcc-4.9-support

Support gcc 4.9 in cmake, fix uninitialized value warnings
parents 6658f899 bfe318a4
...@@ -7,6 +7,31 @@ project(TokuDB) ...@@ -7,6 +7,31 @@ project(TokuDB)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
## Versions of gcc >= 4.9.0 require special version of 'ar' and 'ranlib' for
## link-time optimizations to work properly.
##
## From https://gcc.gnu.org/gcc-4.9/changes.html:
##
## When using a linker plugin, compiling with the -flto option now
## generates slim objects files (.o) which only contain intermediate
## language representation for LTO. Use -ffat-lto-objects to create
## files which contain additionally the object code. To generate
## static libraries suitable for LTO processing, use gcc-ar and
## gcc-ranlib; to list symbols from a slim object file use
## gcc-nm. (Requires that ar, ranlib and nm have been compiled with
## plugin support.)
if ((CMAKE_CXX_COMPILER_ID STREQUAL GNU) AND
NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0"))
find_program(gcc_ar "gcc-ar")
if (gcc_ar)
set(CMAKE_AR "${gcc_ar}")
endif ()
find_program(gcc_ranlib "gcc-ranlib")
if (gcc_ranlib)
set(CMAKE_RANLIB "${gcc_ranlib}")
endif ()
endif()
include(TokuFeatureDetection) include(TokuFeatureDetection)
include(TokuSetupCompiler) include(TokuSetupCompiler)
include(TokuSetupCTest) include(TokuSetupCTest)
......
...@@ -321,8 +321,8 @@ toku_maybe_upgrade_log(const char *env_dir, const char *log_dir, LSN * lsn_of_cl ...@@ -321,8 +321,8 @@ toku_maybe_upgrade_log(const char *env_dir, const char *log_dir, LSN * lsn_of_cl
r = 0; //Logs are up to date r = 0; //Logs are up to date
else { else {
FOOTPRINT(4); FOOTPRINT(4);
LSN last_lsn; LSN last_lsn = ZERO_LSN;
TXNID last_xid; TXNID last_xid = TXNID_NONE;
r = verify_clean_shutdown_of_log_version(log_dir, version_of_logs_on_disk, &last_lsn, &last_xid); r = verify_clean_shutdown_of_log_version(log_dir, version_of_logs_on_disk, &last_lsn, &last_xid);
if (r != 0) { if (r != 0) {
goto cleanup; goto cleanup;
......
...@@ -621,7 +621,7 @@ int toku_logger_find_next_unused_log_file(const char *directory, long long *resu ...@@ -621,7 +621,7 @@ int toku_logger_find_next_unused_log_file(const char *directory, long long *resu
if (d==0) return get_error_errno(); if (d==0) return get_error_errno();
while ((de=readdir(d))) { while ((de=readdir(d))) {
if (de==0) return get_error_errno(); if (de==0) return get_error_errno();
long long thisl; long long thisl = -1;
if ( is_a_logfile(de->d_name, &thisl) ) { if ( is_a_logfile(de->d_name, &thisl) ) {
if ((long long)thisl > maxf) maxf = thisl; if ((long long)thisl > maxf) maxf = thisl;
} }
......
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