Print this page
10703 smatch unreachable code checking needs reworking
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/os-tests/tests/file-locking/util.c
          +++ new/usr/src/test/os-tests/tests/file-locking/util.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2018 Joyent, Inc.
       13 + * Copyright 2019 Joyent, Inc.
  14   14   */
  15   15  
  16   16  /*
  17   17   * Utility functions for use in both acquire-lock and runtests.
  18   18   */
  19   19  
  20   20  #include "util.h"
  21   21  #include <err.h>
  22   22  #include <errno.h>
  23   23  #include <poll.h>
↓ open down ↓ 70 lines elided ↑ open up ↑
  94   94  flock_styleenum(char *stylestr)
  95   95  {
  96   96          if (strcmp(stylestr, "posix") == 0) {
  97   97                  return (LSTYLE_POSIX);
  98   98          } else if (strcmp(stylestr, "ofd") == 0) {
  99   99                  return (LSTYLE_OFD);
 100  100          } else if (strcmp(stylestr, "flock") == 0) {
 101  101                  return (LSTYLE_FLOCK);
 102  102          } else {
 103  103                  errx(EXIT_FAILURE, BAD_LOCK_MESSAGE);
 104      -                return (LSTYLE_LAST);
 105  104          }
 106  105  }
 107  106  
 108  107  
 109  108  char *
 110  109  flock_stylestr(lock_style_t style)
 111  110  {
 112  111          switch (style) {
 113  112          case LSTYLE_POSIX:
 114  113                  return ("posix");
 115  114          case LSTYLE_OFD:
 116  115                  return ("ofd");
 117  116          case LSTYLE_FLOCK:
 118  117                  return ("flock");
 119  118          default:
 120  119                  abort();
 121      -                return ("<unreachable>");
 122  120          }
 123  121  }
 124  122  
 125  123  
 126  124  char *
 127  125  flock_stylename(lock_style_t style)
 128  126  {
 129  127          switch (style) {
 130  128          case LSTYLE_POSIX:
 131  129                  return ("fcntl(2) POSIX");
 132  130          case LSTYLE_OFD:
 133  131                  return ("fcntl(2) OFD");
 134  132          case LSTYLE_FLOCK:
 135  133                  return ("flock(3C)");
 136  134          default:
 137  135                  abort();
 138      -                return ("<unreachable>");
 139  136          }
 140  137  }
 141  138  
 142  139  
 143  140  void
 144  141  flock_reinit(struct flock *flp, int ltype)
 145  142  {
 146  143          bzero(flp, sizeof (*flp));
 147  144          flp->l_type = ltype;
 148  145  }
↓ open down ↓ 22 lines elided ↑ open up ↑
 171  168  #if !defined(_LP64)
 172  169          case F_OFD_SETLK64:
 173  170                  return ("F_OFD_SETLK64");
 174  171          case F_OFD_SETLKW64:
 175  172                  return ("F_OFD_SETLKW64");
 176  173          case F_OFD_GETLK64:
 177  174                  return ("F_OFD_GETLK64");
 178  175  #endif
 179  176          default:
 180  177                  abort();
 181      -                return ("<unreachable>");
 182  178          }
 183  179  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX