Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c*
Date: Wed, 14 Oct 2020 19:35:44 +0300	[thread overview]
Message-ID: <62b53bfefe4b4dc015184310a7fedf9f472f85f8.1602693164.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <db71f95c3f2d20dbebc8ef7a0013e403751f8b53.1602693164.git.avtikhon@tarantool.org>

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

  reply	other threads:[~2020-10-14 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62b53bfefe4b4dc015184310a7fedf9f472f85f8.1602693164.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 2/4] build: fix Werror warning in test/unit:fiber*.c*' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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