generate-command-parser.pl: remove trailing comma

This commit is contained in:
Orestis Floros 2017-12-10 21:29:56 +02:00
parent 57ee66ad25
commit de3c122337
1 changed files with 3 additions and 4 deletions

View File

@ -116,17 +116,16 @@ my @keys = sort { (length($b) <=> length($a)) or ($a cmp $b) } keys %states;
open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");
# XXX: we might want to have a way to do this without a trailing comma, but gcc
# seems to eat it.
my %statenum;
say $enumfh 'typedef enum {';
my $cnt = 0;
for my $state (@keys, '__CALL') {
say $enumfh " $state = $cnt,";
say $enumfh ',' if $cnt > 0;
print $enumfh " $state = $cnt";
$statenum{$state} = $cnt;
$cnt++;
}
say $enumfh '} cmdp_state;';
say $enumfh "\n} cmdp_state;";
close($enumfh);
# Third step: Generate the call function.