From: Orestis Floros Date: Sun, 10 Dec 2017 19:29:56 +0000 (+0200) Subject: generate-command-parser.pl: remove trailing comma X-Git-Tag: 4.15~27^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=de3c122337b6bc9ec69308047575b90d64208f3b;p=i3%2Fi3 generate-command-parser.pl: remove trailing comma --- 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.