Link [ NetBSD | NetBSD OpenGrok source search | PR fulltext-search | Summary of daily snapshot builds | history of daily build result | pkgsrc commit viewer ]


   
        usage: [branch:branch] [user:user] [path@revision] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN sys/arch/arm, if_wm.c@1.234 )




switch to index mode

recent branches: MAIN (52m)  netbsd-10 (17d)  netbsd-9 (17d)  netbsd-8 (22d) 

2024-06-02 18:36:53 UTC Now

2021-01-08 01:40:03 UTC MAIN commitmail json YAML

lint: demonstrate wrong message 204 (since 2020-12-31)

In func.c 1.39 from 2020-12-31 18:51:28, the check that controlling
expressions are indeed scalar was extended from while and for loops to
if statements as well.  It just seemed to have been an oversight.

This revealed a bug in lint, which didn't accept the following valid
code snippet from lib/libpthread/pthread.c:634:

void _malloc_thread_cleanup(void) __weak;
...
if (_malloc_thread_cleanup)
_malloc_thread_cleanup();

Testing a function (instead of a function pointer) for truthiness is
probably rare since most functions are defined unconditionally.  For
weak functions it comes in handy though.

Clang-Tidy suggests to prefix the function with '&' to silence its
warning.  Doing that revealed a non-obvious behavior in build_ampersand,
which does not add the AMPER node to the expression even though it is
clearly mentioned in the code.  That is left for further research.

Once the original bug is fixed, it probably doesn't matter whether the
AMPER is discarded or retained since check_controlling_expression would
add it back.  There's probably a reason though to sometimes discard the
AMPER and sometimes retain it.

(rillig)