diff mbox series

[2/6] build-aux: header-ifdef: Handle #pragma once

Message ID dfb3ce676c955815e47f907d1e87cda6c1dc5262.1554328223.git.crobinso@redhat.com
State Accepted
Commit ac41ffb8fa1235c226377397842c6c240a677d87
Headers show
Series Some '#pragma once' conversions | expand

Commit Message

Cole Robinson April 3, 2019, 9:52 p.m. UTC
If we see if, skip all remaining header guard checks

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 build-aux/header-ifdef.pl | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Eric Blake April 4, 2019, 5:59 p.m. UTC | #1
On 4/3/19 4:52 PM, Cole Robinson wrote:
> If we see if, skip all remaining header guard checks


s/see if/see it/

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  build-aux/header-ifdef.pl | 5 +++++

>  1 file changed, 5 insertions(+)



-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/build-aux/header-ifdef.pl b/build-aux/header-ifdef.pl
index 297696eb70..401f25fb81 100644
--- a/build-aux/header-ifdef.pl
+++ b/build-aux/header-ifdef.pl
@@ -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 {