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 enum for global apis #1456

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3180,16 +3180,36 @@ sub CreateGlobalFunctions

WriteHeader "";

WriteHeader "typedef enum _sai_global_api_type_t {";
my $typename = "sai_global_api_type_t";

my $prefix = uc $typename;

chop $prefix;

WriteHeader "typedef enum _$typename {";

my @values = ();

for my $name (sort keys %GLOBAL_APIS)
{
my $short = uc($1) if $name =~ /^sai_(\w+)/;

WriteHeader "SAI_GLOBAL_API_TYPE_$short,";

push @values, "SAI_GLOBAL_API_TYPE_$short";
}

WriteHeader "} sai_global_api_type_t;";
WriteHeader "} $typename;";

$SAI_ENUMS{$typename}{values} = \@values;

WriteSectionComment "$typename metadata";

ProcessSingleEnum($typename, $typename, $prefix);

WriteSectionComment "Get $typename helper method";

CreateEnumHelperMethod($typename);
}

sub CreateApisQuery
Expand Down
4 changes: 4 additions & 0 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -5347,6 +5347,10 @@ void check_all_enums()

check_single_enum(emd);
}

check_single_enum(&sai_metadata_enum_sai_global_api_type_t);
check_single_enum(&sai_metadata_enum_sai_switch_notification_type_t);
check_single_enum(&sai_metadata_enum_sai_switch_pointer_type_t);
}

void check_sai_version()
Expand Down