]> git.kaiwu.me - haproxy.git/commit
BUILD: cache: silence an uninitialized warning at -Og with gcc-12.2
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Oct 2024 04:59:12 +0000 (06:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Oct 2024 14:28:54 +0000 (16:28 +0200)
commit0fa654ca925a8661dbe6acc25d3edd9a87a18860
treea0e210a16ecefe44587b708f78f145b3d788d261
parentedf85a1d76a772b70e81919ec4e919e06477fd39
BUILD: cache: silence an uninitialized warning at -Og with gcc-12.2

Building with gcc-12.2 -Og yields this incorrect warning in cache.c:

  In function 'release_entry_unlocked',
      inlined from 'http_action_store_cache' at src/cache.c:1449:4:
  src/cache.c:330:9: warning: 'object' may be used uninitialized [-Wmaybe-uninitialized]
    330 |         release_entry(cache, entry, 1);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/cache.c: In function 'http_action_store_cache':
  src/cache.c:1200:29: note: 'object' was declared here
   1200 |         struct cache_entry *object, *old;
        |                             ^~~~~~

This is wrong, the only way to reach the function is with first!=NULL
and the gotos that reach there are all those made with first==NULL.
Let's just preset object to NULL to silence it.
src/cache.c