[PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was fooling around with clang and noticed that it complains about the
"int x = x" construct under -Wall. That is IMHO a deficiency in clang,
since the idiom has a well-defined use in silencing -Wuninitialized
warnings. But I've also always been nervous about the idiom, because
it's easy to get the analysis wrong (after all, the compiler gets these
cases wrong because they're complex), and it's possible for the code to
change later, introducing a new problem.

So I investigated our uses of the idiom. Many of them are correct and
still necessary. Some are correct but no longer necessary with modern
gcc. And some are technically correct, but the code and its assumptions
can be made clearer (to both a reader and the compiler) with a simple
rewrite. Patches are below for the latter two types.

Note that none of these fixes an actual bug in the current code; this is
purely maintenance hygiene. Nor do any of the patches depend on each
other; we can drop any of them that do not look they are providing a net
benefit.

  [1/4]: wt-status: fix possible use of uninitialized variable
  [2/4]: fast-import: use pointer-to-pointer to keep list tail
  [3/4]: drop some obsolete "x = x" compiler warning hacks
  [4/4]: transport: drop "int cmp = cmp" hack

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]