]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build-aux: header-ifdef: Handle #pragma once
authorCole Robinson <crobinso@redhat.com>
Wed, 3 Apr 2019 21:45:02 +0000 (17:45 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 4 Apr 2019 22:42:09 +0000 (18:42 -0400)
If we see it, skip all remaining header guard checks

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
build-aux/header-ifdef.pl

index 297696eb70abbc0cd045d0d125982e3c5c45ec6a..401f25fb81856463a95037b990c9b04e16549b86 100644 (file)
@@ -32,6 +32,7 @@ my $STATE_GUARD_START = 6;
 my $STATE_GUARD_DEFINE = 7;
 my $STATE_GUARD_END = 8;
 my $STATE_EOF = 9;
+my $STATE_PRAGMA = 10;
 
 my $file = " ";
 my $ret = 0;
@@ -132,6 +133,8 @@ while (<>) {
     } elsif ($state == $STATE_GUARD_START) {
         if (/^$/) {
             &mistake("$file: too many blank lines after copyright header");
+        } elsif(/#pragma once/) {
+            $state = $STATE_PRAGMA;
         } elsif (/#ifndef $ifdef$/) {
             $state = $STATE_GUARD_DEFINE;
         } else {
@@ -147,6 +150,8 @@ while (<>) {
         if (m,#endif /\* $ifdef \*/$,) {
             $state = $STATE_EOF;
         }
+    } elsif ($state == $STATE_PRAGMA) {
+        next;
     } elsif ($state == $STATE_EOF) {
         die "$file: unexpected content after '#endif /* $ifdef */'";
     } else {