Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/sparse.1
          +++ new/usr/src/tools/smatch/src/sparse.1
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13  error.
  14   14  .P
  15   15  Sparse accepts options controlling the set of warnings to generate.  To turn
  16   16  on warnings Sparse does not issue by default, use the corresponding warning
  17   17  option \fB\-Wsomething\fR.  Sparse issues some warnings by default; to turn
  18   18  off those warnings, pass the negation of the associated warning option,
  19   19  \fB\-Wno\-something\fR.
  20   20  .
  21   21  .SH WARNING OPTIONS
  22   22  .TP
       23 +.B \-fmax-warnings=COUNT
       24 +Set the maximum number of displayed warnings to COUNT, which should be
       25 +a numerical value or 'unlimited'.
       26 +The default limit is 100.
       27 +.
       28 +.TP
  23   29  .B \-Wsparse\-all
  24   30  Turn on all sparse warnings, except for those explicitly disabled via
  25   31  \fB\-Wno\-something\fR.
  26   32  .TP
  27   33  .B \-Wsparse\-error
  28   34  Turn all sparse warnings into errors.
  29   35  .TP
  30   36  .B \-Waddress\-space
  31   37  Warn about code which mixes pointers to different address spaces.
  32   38  
  33   39  Sparse allows an extended attribute
  34      -.BI __attribute__((address_space( num )))
  35      -on pointers, which designates a pointer target in address space \fInum\fR (a
  36      -constant integer).  With \fB\-Waddress\-space\fR, Sparse treats pointers with
  37      -identical target types but different address spaces as distinct types.  To
  38      -override this warning, such as for functions which convert pointers between
  39      -address spaces, use a type that includes \fB__attribute__((force))\fR.
       40 +.BI __attribute__((address_space( id )))
       41 +on pointers, which designates a pointer target in address space \fIid\fR (an
       42 +identifier or a constant integer).
       43 +With \fB\-Waddress\-space\fR, Sparse treats pointers with
       44 +identical target types but different address spaces as distinct types and
       45 +will warn accordingly.
  40   46  
       47 +Sparse will also warn on casts which remove the address space (casts to an
       48 +integer type or to a plain pointer type). An exception to this is when the
       49 +destination type is \fBuintptr_t\fR (or \fBunsigned long\fR) since such casts
       50 +are often used to "get a pointer value representation in an integer type" and
       51 +such values are independent of the address space.
       52 +
       53 +To override these warnings, use a type that includes \fB__attribute__((force))\fR.
       54 +
  41   55  Sparse issues these warnings by default.  To turn them off, use
  42   56  \fB\-Wno\-address\-space\fR.
  43   57  .
  44   58  .TP
  45   59  .B \-Wbitwise
  46   60  Warn about unsupported operations or type mismatches with restricted integer
  47   61  types.
  48   62  
  49   63  Sparse supports an extended attribute, \fB__attribute__((bitwise))\fR, which
  50   64  creates a new restricted integer type from a base integer type, distinct from
↓ open down ↓ 13 lines elided ↑ open up ↑
  64   78  types, and that you'd never want to just use as a random integer (the
  65   79  integer 0 is special, though, and gets silently accepted iirc - it's
  66   80  kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness"
  67   81  types would be __bitwise: you can only operate on them by doing
  68   82  specific operations that know about *that* particular type.
  69   83  
  70   84  Sparse issues these warnings by default.  To turn them off, use
  71   85  \fB\-Wno\-bitwise\fR.
  72   86  .
  73   87  .TP
       88 +.B \-Wbitwise\-pointer
       89 +Same as \fB\-Wbitwise\fR but for casts to or from pointers to bitwise types.
       90 +
       91 +Sparse does not issue these warnings by default.
       92 +.
       93 +.TP
       94 +.B \-Wcast\-from\-as
       95 +Warn about casts which remove an address space from a pointer type.
       96 +
       97 +This is similar to \fB\-Waddress\-space\fR but will also warn
       98 +on casts to \fBunsigned long\fR.
       99 +
      100 +Sparse does not issues these warnings by default.
      101 +.
      102 +.TP
  74  103  .B \-Wcast\-to\-as
  75  104  Warn about casts which add an address space to a pointer type.
  76  105  
  77  106  A cast that includes \fB__attribute__((force))\fR will suppress this warning.
      107 +No warning is generated if the original type is \fBuintptr_t\fR
      108 +(or \fBunsigned long\fR).
  78  109  
  79  110  Sparse does not issue these warnings by default.
  80  111  .
  81  112  .TP
  82  113  .B \-Wcast\-truncate
  83  114  Warn about casts that truncate constant values.
  84  115  
  85  116  Sparse issues these warnings by default.  To turn them off, use
  86  117  \fB\-Wno\-cast\-truncate\fR.
  87  118  .
↓ open down ↓ 118 lines elided ↑ open up ↑
 206  237  .TP
 207  238  .B \-Wenum\-mismatch
 208  239  Warn about the use of an expression of an incorrect \fBenum\fR type when
 209  240  initializing another \fBenum\fR type, assigning to another \fBenum\fR type, or
 210  241  passing an argument to a function which expects another \fBenum\fR type.
 211  242  
 212  243  Sparse issues these warnings by default.  To turn them off, use
 213  244  \fB\-Wno\-enum\-mismatch\fR.
 214  245  .
 215  246  .TP
 216      -.B \-Wempty\-character\-constant
 217      -Warn about a constant such as ''.
 218      -
 219      -Sparse issues these warnings by default.  To turn them off, use
 220      -\fB\-Wno\-empty\-character\-constant\fR.
 221      -.
 222      -.TP
 223  247  .B \-Wexternal\-function\-has\-definition
 224  248  Warn about function definitions that are declared with external linkage.
 225  249  
 226  250  Sparse issues these warnings by default.  To turn them off, use
 227  251  \fB\-Wno\-external\-function\-has\-definition\fR.
 228  252  .
 229  253  .TP
 230  254  .B \-Winit\-cstring
 231  255  Warn about initialization of a char array with a too long constant C string.
 232  256  
↓ open down ↓ 16 lines elided ↑ open up ↑
 249  273  Warn about call of \fBmemcpy()\fR, \fBmemset()\fR, \fBcopy_from_user()\fR, or
 250  274  \fBcopy_to_user()\fR with a large compile-time byte count.
 251  275  
 252  276  Sparse issues these warnings by default. To turn them off, use
 253  277  \fB\-Wno\-memcpy\-max\-count\fR.
 254  278  
 255  279  The limit can be changed with \fB\-fmemcpy\-max\-count=COUNT\fR,
 256  280  the default being \fB100000\fR.
 257  281  .
 258  282  .TP
 259      -.B \-Wnon\-ansi\-function\-declaration
 260      -Warn about non-ANSI function declarations.
 261      -
 262      -Sparse issues these warnings by default.  To turn them off, use
 263      -\fB\-Wno\-non\-ansi\-function\-declaration\fR.
 264      -.
 265      -.TP
 266  283  .B \-Wnon\-pointer\-null
 267  284  Warn about the use of 0 as a NULL pointer.
 268  285  
 269  286  0 has integer type.  NULL has pointer type.
 270  287  
 271  288  Sparse issues these warnings by default.  To turn them off, use
 272  289  \fB\-Wno\-non\-pointer\-null\fR.
 273  290  .
 274  291  .TP
 275  292  .B \-Wold\-initializer
↓ open down ↓ 83 lines elided ↑ open up ↑
 359  376  .TP
 360  377  .B \-Wshadow
 361  378  Warn when declaring a symbol which shadows a declaration with the same name in
 362  379  an outer scope.
 363  380  
 364  381  Such declarations can lead to error-prone code.
 365  382  
 366  383  Sparse does not issue these warnings by default.
 367  384  .
 368  385  .TP
      386 +.B \-Wshift-count-negative
      387 +Warn if a shift count is negative.
      388 +
      389 +Sparse issues these warnings by default.
      390 +.
      391 +.TP
      392 +.B \-Wshift-count-overflow
      393 +Warn if a shift count is bigger than the operand's width.
      394 +
      395 +Sparse issues these warnings by default.
      396 +.
      397 +.TP
 369  398  .B \-Wsizeof-bool
 370  399  Warn when checking the sizeof a _Bool.
 371  400  
 372      -C99 does not specify the sizeof a _Bool.  gcc uses 1.
      401 +C99 does not specify the size of a _Bool. GCC, by default, uses \fI1\fR.
 373  402  
 374  403  Sparse does not issue these warnings by default.
 375  404  .
 376  405  .TP
 377  406  .B \-Wtransparent\-union
 378  407  Warn about any declaration using the GCC extension
 379  408  \fB__attribute__((transparent_union))\fR.
 380  409  
 381  410  Sparse issues these warnings by default.  To turn them off, use
 382  411  \fB\-Wno\-transparent\-union\fR.
↓ open down ↓ 22 lines elided ↑ open up ↑
 405  434  Look for compiler-provided system headers in \fIdir\fR/include/ and \fIdir\fR/include-fixed/.
 406  435  .
 407  436  .TP
 408  437  .B \-multiarch-dir \fIdir\fR
 409  438  Look for system headers in the multiarch subdirectory \fIdir\fR.
 410  439  The \fIdir\fR name would normally take the form of the target's
 411  440  normalized GNU triplet. (e.g. i386-linux-gnu).
 412  441  .
 413  442  .SH DEBUG OPTIONS
 414  443  .TP
 415      -.B \-fdump-linearize[=only]
 416      -Dump the IR code of a function directly after its linearization,
 417      -before any simplifications are made. If the argument \fB=only\fR is
 418      -also given no further processing is done on the function.
 419      -.
 420  444  .B \-fmem-report
 421  445  Report some statistics about memory allocation used by the tool.
 422  446  .
 423  447  .SH OTHER OPTIONS
 424  448  .TP
      449 +.B \-fdiagnostic-prefix[=PREFIX]
      450 +Prefix all diagnostics by the given PREFIX, followed by ": ".
      451 +If no one is given "sparse" is used.
      452 +The default is to not use a prefix at all.
      453 +.
      454 +.TP
 425  455  .B \-fmemcpy-max-count=COUNT
 426  456  Set the limit for the warnings given by \fB-Wmemcpy-max-count\fR.
 427      -A COUNT of 0, useless in itself, will effectively disable the warning.
      457 +A COUNT of 'unlimited' or '0' will effectively disable the warning.
 428  458  The default limit is 100000.
 429  459  .
 430  460  .TP
 431  461  .B \-ftabstop=WIDTH
 432  462  Set the distance between tab stops.  This helps sparse report correct
 433  463  column numbers in warnings or errors.  If the value is less than 1 or
 434  464  greater than 100, the option is ignored.  The default is 8.
 435  465  .
      466 +.TP
      467 +.B \-f[no-]unsigned-char, \-f[no-]signed-char
      468 +Let plain 'char' be unsigned or signed.
      469 +By default chars are signed.
      470 +.
 436  471  .SH SEE ALSO
 437  472  .BR cgcc (1)
 438  473  .
 439  474  .SH HOMEPAGE
 440  475  http://www.kernel.org/pub/software/devel/sparse/
 441  476  .
 442  477  .SH MAILING LIST
 443  478  linux-sparse@vger.kernel.org
 444  479  .
 445      -.SH MAINTAINER
 446      -Christopher Li <sparse@chrisli.org>
      480 +.SH CONTRIBUTINGS AND REPORTING BUGS
      481 +Submission of patches and reporting of bugs, as well as discussions
      482 +related to Sparse, should be done via the mailing list (linux-sparse@vger.kernel.org)
      483 +where the development and maintenance is primarily done.
      484 +You do not have to be subscribed to the list to send a message there.
      485 +
      486 +Bugs can also be reported and tracked via the Linux kernel's bugzilla:
      487 +http://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools .
      488 +.
      489 +.SH AUTHORS
      490 +Sparse was started by Linus Torvalds.
      491 +The complete list of contributors can be find at
      492 +https://www.openhub.net/p/sparse/contributors .
      493 +
      494 +Luc Van Oostenryck is Sparse's current maintainer.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX