Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meta] Add custom range start/end to sai_object_type_t and sai_api_t as workaround for internal enum size #1926

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

kcudnik
Copy link
Collaborator

@kcudnik kcudnik commented Nov 13, 2023

Workadound for #1925

Since SAI_OBJECT_TYPE_EXTENSIONS_MAX is declared as define, compiler warns about:

error: the result of the conversion is unspecified because .129. is outside the range of type .sai_object_type_t. {aka
._sai_object_type_t.} [-Werror=conversion]

when next value exceeds 7 bits, since that's enough for encode all values for sai_object_type_t. Unfortunetly #pragma GCC diagnostic ignored "-Wconversion" is not working (probably gcc bug) then workaround needs to be addressed in other way.

Those custom ranges can be removed after actual SAI_OBJECT_TYPE_MAX will reach 128 value

Workadound for opencomputeproject#1925

Since SAI_OBJECT_TYPE_EXTENSIONS_MAX is declared as define, compiler
warns about:

error: the result of the conversion is unspecified because .129. is
outside the range of type .sai_object_type_t. {aka
    ._sai_object_type_t.} [-Werror=conversion]

when next value exceeds 7 bits, since that's enough for encode all
values for sai_object_type_t. Unfortunetly #pragma GCC diagnostic
ignored "-Wconversion" is not working (probably gcc bug) then
workaround needs to be addressed in other way.

Those custom ranges can be removed after actual SAI_OBJECT_TYPE_MAX
will reach 128 value
Same issue as sai_object_type_t. This is temporary workaround
@kcudnik kcudnik changed the title [meta] Add custom range start/end to sai_object_type_t as workaround for internal enum size [meta] Add custom range start/end to sai_object_type_t and sai_api_t as workaround for internal enum size Nov 16, 2023
@kcudnik
Copy link
Collaborator Author

kcudnik commented Nov 16, 2023

issue demonstration here: https://godbolt.org/z/8Mdse7jva

@kcudnik kcudnik merged commit eaf2812 into opencomputeproject:master Nov 17, 2023
3 checks passed
@kcudnik kcudnik deleted the otwork branch November 17, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant