gnucash maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Sat Sep 1 06:07:57 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/d07f759c (commit)
via https://github.com/Gnucash/gnucash/commit/4c87dd05 (commit)
from https://github.com/Gnucash/gnucash/commit/bf00330e (commit)
commit d07f759ca35ef8095c19c5dc8ae4354ce5367ce5
Author: Geert Janssens <geert at kobaltwit.be>
Date: Sat Sep 1 12:00:38 2018 +0200
Use alignment-safe buffer handling
Casting a char* to a struct containing a uint32_t is not universally safe
due to alignment constraints on reads on some platforms. Copy our possibly
unaligned source data into an aligned area of memory to avoid SIGBUS on
armhf.
Reported by vorlonofportland in PR#403. This commit the John's optimized
version of Vorlon's proposed fix.
diff --git a/libgnucash/engine/gnc-timezone.cpp b/libgnucash/engine/gnc-timezone.cpp
index 876df2a..01325b4 100644
--- a/libgnucash/engine/gnc-timezone.cpp
+++ b/libgnucash/engine/gnc-timezone.cpp
@@ -471,7 +471,9 @@ namespace IANAParser
for(uint32_t index = 0; index < type_count; ++index)
{
fb_index = start_index + index * tzinfo_size;
- TTInfo info = *reinterpret_cast<TTInfo*>(&fileblock[fb_index]);
+ /* Use memcpy instead of static_cast to avoid memory alignment issues with chars */
+ TTInfo info{};
+ memcpy(&info, &fileblock[fb_index], ttinfo_size);
endian_swap(&info.gmtoff);
tzinfo.push_back(
{info, &fileblock[abbrev + info.abbrind],
commit 4c87dd05ec8f1da40292f3e2f0004418a573ab89
Author: Geert Janssens <geert at kobaltwit.be>
Date: Sat Sep 1 11:43:04 2018 +0200
Fix compiler warning issues
- add -Wno-deprecated-declarations to CXX_FLAGS as well. This was
reported by vorlonofportland in PR#401 to become necessary for glib 2.58
as that has deprecated g_type_class_add_private which appears in our
c++ code.
- change -Wno-deprecated-register into -Wregister. The former appeared to
be a clang dialect and alias for the latter (see
https://github.com/Barro/compiler-warnings for an overview of clang
and gcc warnings). It was moved to global CXX_FLAGS as it can only be
added for g++.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2fcffb..b2ecf7d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -572,8 +572,9 @@ set(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}") # FIXME: should be -std=
if (UNIX)
set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused ${CMAKE_C_FLAGS}")
- set( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations -Wno-unused -Wno-error=parentheses ${CMAKE_CXX_FLAGS}")
set( CMAKE_C_FLAGS "-Wno-deprecated-declarations -std=gnu11 -Wno-error=parentheses ${CMAKE_C_FLAGS}")
+ set( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations -Wno-unused -Wno-error=parentheses ${CMAKE_CXX_FLAGS}")
+ set( CMAKE_CXX_FLAGS "-Wno-deprecated-declarations -Wno-register ${CMAKE_CXX_FLAGS}")
set( CMAKE_C_FLAGS_RELEASE "-O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${CMAKE_C_FLAGS}")
endif (UNIX)
if (MINGW)
diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt
index dd9c8fb..526f20f 100644
--- a/libgnucash/engine/CMakeLists.txt
+++ b/libgnucash/engine/CMakeLists.txt
@@ -235,7 +235,6 @@ add_dependencies (gncmod-engine swig-runtime-h iso-4217-c)
target_link_libraries(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
target_compile_definitions (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")
-target_compile_options (gncmod-engine PRIVATE -Wno-deprecated-register)
target_include_directories (gncmod-engine
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for iso-4217-currencies.c
Summary of changes:
CMakeLists.txt | 3 ++-
libgnucash/engine/CMakeLists.txt | 1 -
libgnucash/engine/gnc-timezone.cpp | 4 +++-
3 files changed, 5 insertions(+), 3 deletions(-)
More information about the gnucash-changes
mailing list