mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 01:15:50 +08:00
[clang][analyzer] Change value of checker option in unix.StdCLibraryFunctions (second try). (#80457)
Default value of checker option `ModelPOSIX` is changed to `true`.
Documentation is updated.
This is a re-apply of commit 7af4e8bcc3
that was reverted because a test failure (this is fixed now).
This commit is contained in:
@@ -1320,10 +1320,23 @@ range of the argument.
|
||||
|
||||
**Parameters**
|
||||
|
||||
The checker models functions (and emits diagnostics) from the C standard by
|
||||
default. The ``ModelPOSIX`` option enables modeling (and emit diagnostics) of
|
||||
additional functions that are defined in the POSIX standard. This option is
|
||||
disabled by default.
|
||||
The ``ModelPOSIX`` option controls if functions from the POSIX standard are
|
||||
recognized by the checker.
|
||||
|
||||
With ``ModelPOSIX=true``, many POSIX functions are modeled according to the
|
||||
`POSIX standard`_. This includes ranges of parameters and possible return
|
||||
values. Furthermore the behavior related to ``errno`` in the POSIX case is
|
||||
often that ``errno`` is set only if a function call fails, and it becomes
|
||||
undefined after a successful function call.
|
||||
|
||||
With ``ModelPOSIX=false``, this checker follows the C99 language standard and
|
||||
only models the functions that are described there. It is possible that the
|
||||
same functions are modeled differently in the two cases because differences in
|
||||
the standards. The C standard specifies less aspects of the functions, for
|
||||
example exact ``errno`` behavior is often unspecified (and not modeled by the
|
||||
checker).
|
||||
|
||||
Default value of the option is ``true``.
|
||||
|
||||
.. _osx-checkers:
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ def StdCLibraryFunctionsChecker : Checker<"StdCLibraryFunctions">,
|
||||
"ModelPOSIX",
|
||||
"If set to true, the checker models additional functions "
|
||||
"from the POSIX standard.",
|
||||
"false",
|
||||
"true",
|
||||
InAlpha>
|
||||
]>,
|
||||
WeakDependencies<[CallAndMessageChecker, NonNullParamChecker]>,
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
// CHECK-NEXT: unix.DynamicMemoryModeling:Optimistic = false
|
||||
// CHECK-NEXT: unix.Errno:AllowErrnoReadOutsideConditionExpressions = true
|
||||
// CHECK-NEXT: unix.StdCLibraryFunctions:DisplayLoadedSummaries = false
|
||||
// CHECK-NEXT: unix.StdCLibraryFunctions:ModelPOSIX = false
|
||||
// CHECK-NEXT: unix.StdCLibraryFunctions:ModelPOSIX = true
|
||||
// CHECK-NEXT: unroll-loops = false
|
||||
// CHECK-NEXT: verbose-report-filename = false
|
||||
// CHECK-NEXT: widen-loops = false
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// RUN: -analyzer-checker=unix.StdCLibraryFunctions \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=false \
|
||||
// RUN: -triple i686-unknown-linux \
|
||||
// RUN: -verify
|
||||
|
||||
@@ -11,6 +12,7 @@
|
||||
// RUN: -analyzer-checker=unix.StdCLibraryFunctions \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=false \
|
||||
// RUN: -triple x86_64-unknown-linux \
|
||||
// RUN: -verify
|
||||
|
||||
@@ -19,6 +21,7 @@
|
||||
// RUN: -analyzer-checker=unix.StdCLibraryFunctions \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=false \
|
||||
// RUN: -triple armv7-a15-linux \
|
||||
// RUN: -verify
|
||||
|
||||
@@ -27,6 +30,7 @@
|
||||
// RUN: -analyzer-checker=unix.StdCLibraryFunctions \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=false \
|
||||
// RUN: -triple thumbv7-a15-linux \
|
||||
// RUN: -verify
|
||||
|
||||
@@ -36,6 +40,7 @@
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:DisplayLoadedSummaries=true \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=false \
|
||||
// RUN: -triple i686-unknown-linux 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: Loaded summary for: int isalnum(int)
|
||||
|
||||
Reference in New Issue
Block a user