Skip to content

Commit 7e75d1a

Browse files
committed
Make FITS_IN_8_BITS() always true under Coverity
Similar in spirit to 3e94db2 Coverity id #28938 Coverity id #104778 Coverity id #131329
1 parent 3ab112c commit 7e75d1a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

handy.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,16 @@ patched there. The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
894894
* compiler to optimize it out if possible. This is because Configure makes
895895
* sure that the machine has an 8-bit byte, so if c is stored in a byte, the
896896
* sizeof() guarantees that this evaluates to a constant true at compile time.
897+
*
898+
* For Coverity, be always true, because otherwise Coverity thinks
899+
* it finds several expressions that are always true, independent
900+
* of operands. Well, they are, but that is kind of the point.
897901
*/
902+
#ifndef __COVERITY__
898903
#define FITS_IN_8_BITS(c) ((sizeof(c) == 1) || !(((WIDEST_UTYPE)(c)) & ~0xFF))
904+
#else
905+
#define FITS_IN_8_BITS(c) (1)
906+
#endif
899907

900908
#ifdef EBCDIC
901909
# ifndef _ALL_SOURCE

0 commit comments

Comments
 (0)