Print this page
new smatch

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