Fix SAI_STATUS_IS_* attribute-range helpers for negative status codes#2308
Conversation
da06436 to
2bb106f
Compare
|
Added check_status_attr_ranges() in meta/saisanitycheck.c (called from main), covering the corner cases from #1235 for all five attribute-error ranges: Encoding value: SAI_STATUS_0 + SAI_STATUS_CODE(index) == SAI_STATUS_CODE(base + index). The test passes with the fixed macros and fails against the current ones, so it guards the fix. Verified it compiles under the meta flags (-Wconversion -Werror). |
2bb106f to
ad55ee6
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
update aspell: |
ad55ee6 to
f904222
Compare
Added xFFFF to meta/aspell.en.pws |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
we could update aspell to automatically exclude all hexadecimal numbers instead of adding each one somewhere here https://github.com/opencomputeproject/SAI/blob/master/meta/aspellcheck.pl#L190 |
Signed-off-by: Mori Levinzon <mlevinzon@nvidia.com>
f904222 to
7a9c7c3
Compare
Updated meta/aspellcheck.pl to skip C-style hexadecimal literals and removed the one-off xFFFF entry from meta/aspell.en.pws, so future hex constants won't need dictionary additions |
|
thanks |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thanks @kcudnik! All checks are green and it's approved — please merge when you can |
Fixes #2307
Two fixes in the
SAI_STATUS_IS_*helpers ininc/saistatus.h:SAI_STATUS_CODE(x)) before masking, so the rangecheck is correct for negative status codes on Linux. Previously a non-zero
attribute index borrowed across the 16-bit boundary and matched the wrong
range (e.g.
INVALID_ATTR_VALUEindex 3 classified asATTR_NOT_IMPLEMENTED).No-op on Windows, where
SAI_STATUS_CODEis identity.SAI_STATUS_IS_UNKNOWN_ATTRIBUTE, which compared againstSAI_STATUS_INVALID_ATTRIBUTE_0instead ofSAI_STATUS_UNKNOWN_ATTRIBUTE_0(wrong on all platforms).