Alexey Serbin has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/23055 )

Change subject: [util] eliminate compiler warnings in RLE encoding debug checks
......................................................................

[util] eliminate compiler warnings in RLE encoding debug checks

This patch resolves two categories of compiler warnings in RLE encoding
that were discovered during Rocky Linux compilation and also exist in CentOS:

1. Boolean comparison warnings (-Wbool-compare):
   For T=bool and BIT_WIDTH=1, the debug check "value < (1LL << BIT_WIDTH)"
   (which evaluates to "value < 2") is always true for boolean values (0 or 1),
   triggering warnings like:
`
/data/code/kudu/src/kudu/util/rle-encoding.h:388:37:
warning: comparison of constant '2' with boolean expression is always true
[-Wbool-compare]
DCHECK(value < (1LL << BIT_WIDTH));
~~~~~^~~~~~~~~~~~~~~~~~~~
`
2. Shift overflow warnings (-Wshift-count-overflow):
For BIT_WIDTH=64, the expression (1LL << 64) causes undefined behavior
by shifting beyond long long's bit width, triggering warnings like:
`
/data/code/kudu/src/kudu/util/rle-encoding.h:388:44:
warning: left shift count >= width of type [-Wshift-count-overflow]
DCHECK(value < (1LL << BIT_WIDTH));
~~~~^~~~~~~~~~~~~
`

Change-Id: I230fb92acb18aeda29766f2f131beac9eca8dab9
Reviewed-on: http://gerrit.cloudera.org:8080/23055
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
---
M src/kudu/util/rle-encoding.h
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Alexey Serbin: Looks good to me, approved; Verified

--
To view, visit http://gerrit.cloudera.org:8080/23055
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I230fb92acb18aeda29766f2f131beac9eca8dab9
Gerrit-Change-Number: 23055
Gerrit-PatchSet: 3
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to