KeDeng has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/23059 )

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]>
(cherry picked from commit 1550f239ea6e50bb8f84a51255fe1b8accb536aa)
Reviewed-on: http://gerrit.cloudera.org:8080/23059
Tested-by: KeDeng <[email protected]>
Reviewed-by: KeDeng <[email protected]>
---
M src/kudu/util/rle-encoding.h
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  KeDeng: Looks good to me, approved; Verified

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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.18.x
Gerrit-MessageType: merged
Gerrit-Change-Id: I230fb92acb18aeda29766f2f131beac9eca8dab9
Gerrit-Change-Number: 23059
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Abhishek Chennaka <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to