aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-03-30 13:34:09 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-03-30 17:35:50 +0100
commitc4c9935b129f63fe837bab2e1e3e5db6d32b7fb8 (patch)
tree4779e10f1b067bbf32f3a2f971113a7075468859
parentb3daa62b53109dba78c7937b3a6a0cd7d67865d5 (diff)
downloadsparse-c4c9935b129f63fe837bab2e1e3e5db6d32b7fb8.tar.gz
man: explain role of uintptr_t & unsigned long in casts from AS pointers
Sparse will warn on casts removing the address space of a pointer if the destination type is not uintptr_t or unsigned long. But the special role of these 2 types is not explained in the man page. So, add an explanation for them in the description of -Waddress-space. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--sparse.113
1 files changed, 10 insertions, 3 deletions
diff --git a/sparse.1 b/sparse.1
index fae6196b..78d0b1ec 100644
--- a/sparse.1
+++ b/sparse.1
@@ -41,9 +41,16 @@ Sparse allows an extended attribute
on pointers, which designates a pointer target in address space \fIid\fR (an
identifier or a constant integer).
With \fB\-Waddress\-space\fR, Sparse treats pointers with
-identical target types but different address spaces as distinct types. To
-override this warning, such as for functions which convert pointers between
-address spaces, use a type that includes \fB__attribute__((force))\fR.
+identical target types but different address spaces as distinct types and
+will warn accordingly.
+
+Sparse will also warn on casts which remove the address space (casts to an
+integer type or to a plain pointer type). An exception to this is when the
+destination type is \fBuintptr_t\fR (or \fBunsigned long\fR) since such casts
+are often used to "get a pointer value representation in an integer type" and
+such values are independent of the address space.
+
+To override these warnings, use a type that includes \fB__attribute__((force))\fR.
Sparse issues these warnings by default. To turn them off, use
\fB\-Wno\-address\-space\fR.