From af7c4ae76b2b4a88af52d77a2ffecb5da2ad051f Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Mon, 20 Apr 2020 04:14:26 +0200 Subject: [PATCH] generate-command-parser: Add '#pragma once' --- generate-command-parser.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generate-command-parser.pl b/generate-command-parser.pl index a017edab2..77502db7e 100755 --- a/generate-command-parser.pl +++ b/generate-command-parser.pl @@ -117,6 +117,7 @@ sub slurp { open(my $enumfh, '>', "GENERATED_${prefix}_enums.h"); my %statenum; +say $enumfh '#pragma once'; say $enumfh 'typedef enum {'; my $cnt = 0; for my $state (@keys, '__CALL') { @@ -131,6 +132,7 @@ sub slurp { # Third step: Generate the call function. open(my $callfh, '>', "GENERATED_${prefix}_call.h"); my $resultname = uc(substr($prefix, 0, 1)) . substr($prefix, 1) . 'ResultIR'; +say $callfh '#pragma once'; say $callfh "static void GENERATED_call(const int call_identifier, struct $resultname *result) {"; say $callfh ' switch (call_identifier) {'; my $call_id = 0; @@ -206,6 +208,7 @@ sub slurp { # Fourth step: Generate the token datastructures. open(my $tokfh, '>', "GENERATED_${prefix}_tokens.h"); +say $tokfh '#pragma once'; for my $state (@keys) { my $tokens = $states{$state};