Skip to content

Commit

Permalink
[meta] Use strinct flags on sai_port_error_status_t (#2083)
Browse files Browse the repository at this point in the history
Mark flags as string on sai_port_error_status_t, also allow
metadata to correctly validate first entry with value zero.
  • Loading branch information
kcudnik authored Oct 4, 2024
1 parent 57ca56b commit 6625165
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ typedef enum _sai_port_oper_status_t

/**
* @brief Attribute data for #SAI_PORT_ATTR_ERROR_STATUS
*
* Note enum values must be powers of 2 to be used as Bit mask to query multiple errors
*
* @flags free
* @flags strict
*/
typedef enum _sai_port_error_status_t
{
Expand Down
7 changes: 7 additions & 0 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -5574,6 +5574,13 @@ void check_enum_flags_type_strict(

size_t i = 0;

if (emd->values[0] == 0)
{
/* first value in strict flags is zero (no flags, we allow this case) */

i = 1;
}

for (; i < emd->valuescount; ++i)
{
int val = emd->values[i];
Expand Down

0 comments on commit 6625165

Please sign in to comment.