1. 24 Oct, 2016 4 commits
    • Kir Kolyshkin's avatar
      zdtm: compile fix for clang · 3c75cf51
      Kir Kolyshkin authored
      clang complains about an unused function:
      
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
      > -iquote ./arch/x86/include  -c -o parseargs.o parseargs.c
      > parseargs.c:12:1: error: unused function '__check_help'
      > [-Werror,-Wunused-function]
      > TEST_OPTION(help, bool, "print help message and exit", 0);
      > ^
      > ./zdtmtst.h:71:2: note: expanded from macro 'TEST_OPTION'
      >         param_check_##type(name, &(name));
      > \
      >         ^
      > <scratch space>:46:1: note: expanded from here
      > param_check_bool
      > ^
      > ./zdtmtst.h:84:35: note: expanded from macro 'param_check_bool'
      > #define param_check_bool(name, p) __param_check(name, p, int)
      >                                   ^
      > ./zdtmtst.h:78:22: note: expanded from macro '__param_check'
      >         static inline type *__check_##name(void) { return(p); }
      >                             ^
      > <scratch space>:47:1: note: expanded from here
      > __check_help
      > ^
      > 1 error generated.
      > <builtin>: recipe for target 'parseargs.o' failed
      
      As far as I can tell, the functions __check_##name are generated in
      order to check the argument type by the compiler.
      
      For gcc, the "inline" keyword is enough to suppress the "unused function"
      warning even when -Wunused-function is used. For clang, it's not the
      case (see https://llvm.org/bugs/show_bug.cgi?id=22712).
      
      A way to "use" the function is to use its name as a pointer and cast it
      to void. This is what this patch does.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      3c75cf51
    • Kir Kolyshkin's avatar
      criu/mount.c: rm unused function · e48a46f3
      Kir Kolyshkin authored
      Commit 308741d0 removes all calls to path_length(), but the function
      itself is still there. Now, clang complains that it is unused.
      
      Remove it.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      e48a46f3
    • Kir Kolyshkin's avatar
      criu/filesystems.c: refactor binfmt_misc_restore_bme · 02c3605c
      Kir Kolyshkin authored
      The following error is emitted by clang:
      
      >   CC       criu/filesystems.o
      > criu/filesystems.c:280:13: error: variable 'ret' is used uninitialized
      >    whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
      >         } else if (bme->extension) {
      >                    ^~~~~~~~~~~~~~
      > criu/filesystems.c:287:6: note: uninitialized use occurs here
      >         if (ret > 0) {
      >             ^~~
      > criu/filesystems.c:280:9: note: remove the 'if' if its condition is
      >    always true
      >         } else if (bme->extension) {
      >                ^~~~~~~~~~~~~~~~~~~~
      > criu/filesystems.c:272:9: note: initialize the variable 'ret' to silence
      >    this warning
      >         int ret;
      >                ^
      >                 = 0
      > 1 error generated.
      
      This code was a result of commit 398e7d3.
      
      If we look closely, this is a false alarm, as "else if (bme->extension)"
      is always true as it was checked before. But this is not very clear,
      and the issue with clangs still needs to be fixed.
      
      There are many ways to do so:
      
      1. Initialize ret to 0. This is what initial version of this patch did.
      
      2. Remove the always-true condition, like this:
      
      	-	} else if (bme->extension) {
      	+	} else {
      
      In my opinion this would hurt readability.
      
      3. Change the code flow, improving readability at the same time.
      
      I believe that #3 is what this patch does. In addition, it fixes
      handling of a few corner cases:
      
      - an overflow in snprintf();
      - a case when bme->name is NULL (as it is used for strlen/snprintf,
        there is a potential for SIGSEGV);
      - a case of ret == 0 (currently there is no code flow that
        results in ret being 0, so it's just for the future).
      
      [v2: use linux kernel style for 'else' after a block]
      [xemul: Fix // comments ]
      
      Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Acked-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      02c3605c
    • Adrian Reber's avatar
      Added --display-stats to the man page · 64f964f0
      Adrian Reber authored
      Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      64f964f0
  2. 17 Oct, 2016 1 commit
  3. 14 Oct, 2016 1 commit
  4. 13 Oct, 2016 14 commits
  5. 10 Oct, 2016 14 commits
  6. 05 Oct, 2016 6 commits