From de3c122337b6bc9ec69308047575b90d64208f3b Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sun, 10 Dec 2017 21:29:56 +0200 Subject: [PATCH] generate-command-parser.pl: remove trailing comma --- generate-command-parser.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate-command-parser.pl b/generate-command-parser.pl index a7687c7b..eeec7dfe 100755 --- a/generate-command-parser.pl +++ b/generate-command-parser.pl @@ -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. -- 2.39.5