Projects STRLCPY criu Commits 156c8da3
🤬
  • 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 <[email protected]>
  • Loading...
  • Pavel Tikhomirov committed with Andrei Vagin 1 year ago
    156c8da3
    1 parent 4930c980
  • ■ ■ ■ ■ ■ ■
    Makefile
    skipped 105 lines
    106 106   
    107 107  WARNINGS := -Wall -Wformat-security -Wdeclaration-after-statement -Wstrict-prototypes
    108 108   
     109 +# -Wdangling-pointer results in false warning when we add a list element to
     110 +# local list head variable. It is false positive because before leaving the
     111 +# function we always check that local list head variable is empty, thus
     112 +# insuring that pointer to it is not dangling anywhere, but gcc can't
     113 +# understand it.
     114 +# Note: There is similar problem with kernel list, where this warning is also
     115 +# disabled: https://github.com/torvalds/linux/commit/49beadbd47c2
     116 +WARNINGS += -Wno-dangling-pointer -Wno-unknown-warning-option
     117 + 
    109 118  CFLAGS-GCOV := --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
    110 119  export CFLAGS-GCOV
    111 120   
    skipped 360 lines
Please wait...
Page is in error, reload to recover