Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c
@ 2020-10-14 16:35 Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c* Alexander V. Tikhonov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alexander V. Tikhonov @ 2020-10-14 16:35 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

Found on GCC 4.8.5 on CentOS 7 issue:

  build/usr/src/debug/tarantool-2.6.0.144/src/box/txn.c:944:30: error: ‘limbo_entry’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (txn_limbo_wait_complete(&txn_limbo, limbo_entry) < 0)

Set limbo_entry variable to NULL on initialization.

Needed for #4941
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4941-gcc-old
Issue: https://github.com/tarantool/tarantool/issues/4941

 src/box/txn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/txn.c b/src/box/txn.c
index 4f5484ec5..eb725aaa9 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -886,7 +886,7 @@ int
 txn_commit(struct txn *txn)
 {
 	struct journal_entry *req;
-	struct txn_limbo_entry *limbo_entry;
+	struct txn_limbo_entry *limbo_entry = NULL;
 
 	txn->fiber = fiber();
 
-- 
2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c*
  2020-10-14 16:35 [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Alexander V. Tikhonov
@ 2020-10-14 16:35 ` Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 3/4] build: add Werror flag to CentOS7 packages build Alexander V. Tikhonov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander V. Tikhonov @ 2020-10-14 16:35 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

Building with gcc-4.8.5 on CentOS 7 found issue:

cd /source/build/usr/src/debug/tarantool-2.6.0.144/test/unit && /usr/bin/g++ ... -Wp,-D_FORTIFY_SOURCE=2 ... -O2 ... -O0 -o CMakeFiles/fiber.test.dir/fiber.cc.o -c /source/build/usr/src/debug/tarantool-2.6.0.144/test/unit/fiber.cc
In file included from /usr/include/inttypes.h:25:0,
                 from /source/build/usr/src/debug/tarantool-2.6.0.144/src/lib/small/small/region.h:34,
                 from /source/build/usr/src/debug/tarantool-2.6.0.144/src/lib/core/memory.h:33,
                 from /source/build/usr/src/debug/tarantool-2.6.0.144/test/unit/fiber.cc:1:
/usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)

It happened because _FORTIFY_SOURCE=2 flag needed -O[1|2] optimization,
but latest set in command was -O0. To fix it added undefine flag:

  -U_FORTIFY_SOURCE

in test/unit/CmakeLists.txt file where -O0 was set.

Needed for #4941
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4941-gcc-old
Issue: https://github.com/tarantool/tarantool/issues/4941

 test/unit/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index aace8cf50..4fb46bbd5 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -77,11 +77,11 @@ add_executable(mp_error.test mp_error.cc core_test_utils.c)
 target_link_libraries(mp_error.test box_error core unit)
 
 add_executable(fiber.test fiber.cc core_test_utils.c)
-set_source_files_properties(fiber.cc PROPERTIES COMPILE_FLAGS -O0)
+set_source_files_properties(fiber.cc PROPERTIES COMPILE_FLAGS "-Wp,-U_FORTIFY_SOURCE -O0")
 target_link_libraries(fiber.test core unit)
 
 add_executable(fiber_stack.test fiber_stack.c core_test_utils.c)
-set_source_files_properties(fiber_stack.c PROPERTIES COMPILE_FLAGS -O0)
+set_source_files_properties(fiber_stack.c PROPERTIES COMPILE_FLAGS "-Wp,-U_FORTIFY_SOURCE -O0")
 target_link_libraries(fiber_stack.test core unit)
 
 if (NOT ENABLE_GCOV)
-- 
2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH v1 3/4] build: add Werror flag to CentOS7 packages build
  2020-10-14 16:35 [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c* Alexander V. Tikhonov
@ 2020-10-14 16:35 ` Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 4/4] gitlab-ci: test default gcc on CentOS 7 Alexander V. Tikhonov
  2020-10-15  8:53 ` [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Kirill Yukhin
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander V. Tikhonov @ 2020-10-14 16:35 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

To check warnings on the default compiler on CentOS7 needed to enable
Werror flag. Currently not all builds with different OS used for
packaging ready for it, so only for CentOS 7 enabled it.

Part of #4941
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4941-gcc-old
Issue: https://github.com/tarantool/tarantool/issues/4941

 rpm/tarantool.spec | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index eedc0312c..a9c625eae 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -159,6 +159,9 @@ C and Lua/C modules.
          -DWITH_SYSTEMD:BOOL=ON \
          -DSYSTEMD_UNIT_DIR:PATH=%{_unitdir} \
          -DSYSTEMD_TMPFILES_DIR:PATH=%{_tmpfilesdir} \
+%endif
+%if 0%{?rhel} == 7
+         -DENABLE_WERROR=ON \
 %endif
          -DENABLE_DIST:BOOL=ON
 make %{?_smp_mflags}
-- 
2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH v1 4/4] gitlab-ci: test default gcc on CentOS 7
  2020-10-14 16:35 [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c* Alexander V. Tikhonov
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 3/4] build: add Werror flag to CentOS7 packages build Alexander V. Tikhonov
@ 2020-10-14 16:35 ` Alexander V. Tikhonov
  2020-10-15  8:53 ` [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Kirill Yukhin
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander V. Tikhonov @ 2020-10-14 16:35 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

Sometimes it is convenient to use default compiler on CentOS 7.
Added test job which uses for compiling default compiler files:

  CC=/usr/bin/gcc
  CXX=/usr/bin/g++

Closes #4941
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4941-gcc-old
Issue: https://github.com/tarantool/tarantool/issues/4941

 .gitlab-ci.yml | 7 +++++++
 .gitlab.mk     | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d40dc74e3..5fc5d3b39 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -256,6 +256,13 @@ jepsen:
       - jepsen-tests-prefix/src/jepsen-tests/store
     expire_in: 6 month
 
+default_gcc_centos_7:
+  <<: *pack_test_definition
+  variables:
+    PACKPACK_EXTRA_DOCKER_RUN_PARAMS: '-e CC=/usr/bin/gcc -e CXX=/usr/bin/g++'
+    OS: 'el'
+    DIST: '7'
+
 # ####
 # Perf
 # ####
diff --git a/.gitlab.mk b/.gitlab.mk
index e1a83ac07..c1fc80320 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -116,7 +116,7 @@ deploy_prepare:
 	rm -rf build
 
 package: deploy_prepare
-	PACKPACK_EXTRA_DOCKER_RUN_PARAMS='--network=host' ./packpack/packpack
+	PACKPACK_EXTRA_DOCKER_RUN_PARAMS="--network=host ${PACKPACK_EXTRA_DOCKER_RUN_PARAMS}" ./packpack/packpack
 
 deploy: package
 	echo ${GPG_SECRET_KEY} | base64 -d | gpg --batch --import || true
-- 
2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c
  2020-10-14 16:35 [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Alexander V. Tikhonov
                   ` (2 preceding siblings ...)
  2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 4/4] gitlab-ci: test default gcc on CentOS 7 Alexander V. Tikhonov
@ 2020-10-15  8:53 ` Kirill Yukhin
  3 siblings, 0 replies; 5+ messages in thread
From: Kirill Yukhin @ 2020-10-15  8:53 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

Hello,

On 14 окт 19:35, Alexander V. Tikhonov wrote:
> Found on GCC 4.8.5 on CentOS 7 issue:
> 
>   build/usr/src/debug/tarantool-2.6.0.144/src/box/txn.c:944:30: error: ‘limbo_entry’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>      if (txn_limbo_wait_complete(&txn_limbo, limbo_entry) < 0)
> 
> Set limbo_entry variable to NULL on initialization.
> 
> Needed for #4941

I've checked your patch into 2.5 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-15  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 16:35 [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Alexander V. Tikhonov
2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c* Alexander V. Tikhonov
2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 3/4] build: add Werror flag to CentOS7 packages build Alexander V. Tikhonov
2020-10-14 16:35 ` [Tarantool-patches] [PATCH v1 4/4] gitlab-ci: test default gcc on CentOS 7 Alexander V. Tikhonov
2020-10-15  8:53 ` [Tarantool-patches] [PATCH v1 1/4] build: fix Werror warning in src/box/txn.c Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox