mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
make: disable '-Wdangling-pointer' warning with gcc 12
The patch is similar to what has been done in linux kernel, as this warning effectively prevents us from adding list elements to local list head. See https://github.com/torvalds/linux/commit/49beadbd47c2 Else we have: CC criu/mount.o In file included from criu/include/cr_options.h:7, from criu/mount.c:13: In function '__list_add', inlined from 'list_add' at include/common/list.h:41:2, inlined from 'mnt_tree_for_each' at criu/mount.c:1977:2: include/common/list.h:35:19: error: storing the address of local variable 'postpone' in '((struct list_head *)((char *)start + 8))[24].prev' [-Werror=dangling-pointer=] 35 | new->prev = prev; | ~~~~~~~~~~^~~~~~ criu/mount.c: In function 'mnt_tree_for_each': criu/mount.c:1972:19: note: 'postpone' declared here 1972 | LIST_HEAD(postpone); | ^~~~~~~~ Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
4930c98020
commit
156c8da33c
9
Makefile
9
Makefile
@@ -106,6 +106,15 @@ DEFINES += -D_GNU_SOURCE
|
||||
|
||||
WARNINGS := -Wall -Wformat-security -Wdeclaration-after-statement -Wstrict-prototypes
|
||||
|
||||
# -Wdangling-pointer results in false warning when we add a list element to
|
||||
# local list head variable. It is false positive because before leaving the
|
||||
# function we always check that local list head variable is empty, thus
|
||||
# insuring that pointer to it is not dangling anywhere, but gcc can't
|
||||
# understand it.
|
||||
# Note: There is similar problem with kernel list, where this warning is also
|
||||
# disabled: https://github.com/torvalds/linux/commit/49beadbd47c2
|
||||
WARNINGS += -Wno-dangling-pointer -Wno-unknown-warning-option
|
||||
|
||||
CFLAGS-GCOV := --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
|
||||
export CFLAGS-GCOV
|
||||
|
||||
|
Reference in New Issue
Block a user