<feed xmlns='http://www.w3.org/2005/Atom'>
<title>netbsd/usr.bin/xlint/lint1/tree.c, branch trunk</title>
<subtitle>NetBSD fork for lockdoc analysis</subtitle>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/'/>
<entry>
<title>lint: remove redundant '#' after 'argument' in diagnostics</title>
<updated>2023-07-09T10:42:07+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-09T10:42:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=61a832267cc5bff1a90f086bd56309a3a0671255'/>
<id>61a832267cc5bff1a90f086bd56309a3a0671255</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>lint: warn about pointer casts between different kinds of types</title>
<updated>2023-07-08T16:13:00+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-08T16:13:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=9299a7c5194512b0d5ea06c7b286d4bae6640791'/>
<id>9299a7c5194512b0d5ea06c7b286d4bae6640791</id>
<content type='text'>
Pointer casts from an integer type to a floating-point type and vice
versa get a 'maybe troublesome' warning now.  The previous assumption
that all types of the same bit-size are convertible may have been valid
from a technical point of view, but still such code should get more
attention.

The rules for struct and union types could be made more fine-grained
later, if the need arises.  To suppress this warning, it's always
possible to cast to an intermediate 'void *'.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pointer casts from an integer type to a floating-point type and vice
versa get a 'maybe troublesome' warning now.  The previous assumption
that all types of the same bit-size are convertible may have been valid
from a technical point of view, but still such code should get more
attention.

The rules for struct and union types could be made more fine-grained
later, if the need arises.  To suppress this warning, it's always
possible to cast to an intermediate 'void *'.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: do not use portable type sizes in integer constraints</title>
<updated>2023-07-08T15:26:25+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-08T15:26:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=65989024f874330227db7d9793fa78cab7c0ee2f'/>
<id>65989024f874330227db7d9793fa78cab7c0ee2f</id>
<content type='text'>
This reverts the change from tree.c 1.547 from 2023-07-03.  Back then, I
didn't know that the actual value from a type's 'portable size in bits'
was not supposed to be used.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts the change from tree.c 1.547 from 2023-07-03.  Back then, I
didn't know that the actual value from a type's 'portable size in bits'
was not supposed to be used.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: warn about conversion from 128-bit to smaller integer types</title>
<updated>2023-07-08T12:45:43+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-08T12:45:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=85af85791b93153321a23d5b18d1865c1d620ccb'/>
<id>85af85791b93153321a23d5b18d1865c1d620ccb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>lint: clean up</title>
<updated>2023-07-08T12:07:21+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-08T12:07:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=c8d1c1b1b539f64aceb2773449908eff62ba034d'/>
<id>c8d1c1b1b539f64aceb2773449908eff62ba034d</id>
<content type='text'>
PUSH nodes are not marked as binary, yet they have a left and a right
operand.

If none of the queries is enabled, omit the query from the debug log.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PUSH nodes are not marked as binary, yet they have a left and a right
operand.

If none of the queries is enabled, omit the query from the debug log.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: clarify the meaning of 'portable size in bits' of a type</title>
<updated>2023-07-08T09:35:35+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-08T09:35:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=cfcdde557958fc701848686dd4db2d8611322218'/>
<id>cfcdde557958fc701848686dd4db2d8611322218</id>
<content type='text'>
No functional change.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional change.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: only warn about traditional/C90 differences in migration mode</title>
<updated>2023-07-07T20:19:08+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-07T20:19:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=c1f166c43175f048ffeb27a51ea2c80a1c068dc1'/>
<id>c1f166c43175f048ffeb27a51ea2c80a1c068dc1</id>
<content type='text'>
In C99 mode, there is no point warning about traditional C.

No change in the tests, as a complete test suite would require several
new test files, and migration mode is not used intensively.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In C99 mode, there is no point warning about traditional C.

No change in the tests, as a complete test suite would require several
new test files, and migration mode is not used intensively.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: only skip 'unused' warnings after errors, not other warnings</title>
<updated>2023-07-07T06:03:31+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-07T06:03:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=f260bdb92f361d3b4e3ab9d23e5f0eb4faafd698'/>
<id>f260bdb92f361d3b4e3ab9d23e5f0eb4faafd698</id>
<content type='text'>
Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that.  This can be seen in
the test gcc_attribute_var.c, where only the last unused variable from a
function was marked as unused, the others slipped through.

Fixed by counting the errors and the warnings separately and only
combining them if actually desired.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that.  This can be seen in
the test gcc_attribute_var.c, where only the last unused variable from a
function was marked as unused, the others slipped through.

Fixed by counting the errors and the warnings separately and only
combining them if actually desired.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: consistently use portable type size in integer constraints</title>
<updated>2023-07-03T21:36:16+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-03T21:36:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=70bab06713c1a381554b075e4b94a5eaefa1608b'/>
<id>70bab06713c1a381554b075e4b94a5eaefa1608b</id>
<content type='text'>
Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible
loss of accuracy when converting from 'long' to 'int' on an ILP32
platform that uses 'unsigned long' for size_t, when run in portable mode
(-p), which is enabled by default in the NetBSD build.

The integer constraints avoid false-positive warnings by looking at the
actual values an expression can take.  The function can_represent is
guarded by a condition that uses the portable_size_in_bits, but then
internally used the opposite size_in_bits, which led to inconsistent
results.

The warning looks confusing though, as on an ILP32 platform, 'int' and
'long' have the same size and representation, therefore there cannot be
an actual loss of accuracy.  The warning may need to be reworded to
explicitly mention the portability mode, in which sizeof(int) is assumed
to be 3 instead of 4, to catch possible loss of accuracy on other
platforms.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible
loss of accuracy when converting from 'long' to 'int' on an ILP32
platform that uses 'unsigned long' for size_t, when run in portable mode
(-p), which is enabled by default in the NetBSD build.

The integer constraints avoid false-positive warnings by looking at the
actual values an expression can take.  The function can_represent is
guarded by a condition that uses the portable_size_in_bits, but then
internally used the opposite size_in_bits, which led to inconsistent
results.

The warning looks confusing though, as on an ILP32 platform, 'int' and
'long' have the same size and representation, therefore there cannot be
an actual loss of accuracy.  The warning may need to be reworded to
explicitly mention the portability mode, in which sizeof(int) is assumed
to be 3 instead of 4, to catch possible loss of accuracy on other
platforms.</pre>
</div>
</content>
</entry>
<entry>
<title>lint: clean up redundant casts</title>
<updated>2023-07-03T07:19:57+00:00</updated>
<author>
<name>rillig</name>
<email>rillig@NetBSD.org</email>
</author>
<published>2023-07-03T07:19:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=4f66bc18c6e65279a5f5b7531dcc7e9e0bb0ab98'/>
<id>4f66bc18c6e65279a5f5b7531dcc7e9e0bb0ab98</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
