summary refs log tree commit diff stats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean-header-guards.pl12
-rw-r--r--scripts/modules/module_block.py2
-rw-r--r--scripts/qapi/commands.py2
-rw-r--r--scripts/qapi/events.py1
-rw-r--r--scripts/qapi/visit.py2
-rw-r--r--scripts/tracetool/format/h.py1
-rw-r--r--scripts/tracetool/format/tcg_helper_c.py1
-rw-r--r--scripts/tracetool/format/ust_events_h.py1
8 files changed, 7 insertions, 15 deletions
diff --git a/scripts/clean-header-guards.pl b/scripts/clean-header-guards.pl
index 5e67f1998c..f47d673ad5 100755
--- a/scripts/clean-header-guards.pl
+++ b/scripts/clean-header-guards.pl
@@ -103,7 +103,7 @@ sub preprocess {
 for my $fname (@ARGV) {
     my $text = slurp($fname);
 
-    $text =~ m,\A(\s*\n|\s*//\N*\n|\s*/\*.*?\*/\s*\n)*|,msg;
+    $text =~ m,\A(\s*\n|\s*//\N*\n|\s*/\*.*?\*/\s*\n)*|,sg;
     my $pre = $&;
     unless ($text =~ /\G(.*\n)/g) {
         $text =~ /\G.*/;
@@ -137,14 +137,16 @@ for my $fname (@ARGV) {
     }
 
     unless ($body =~ m,\A((.*\n)*)
-                       (\s*\#\s*endif\s*(/\*\s*.*\s*\*/\s*)?\n?)
-                       (\n|\s)*\Z,x) {
+                       ([ \t]*\#[ \t]*endif([ \t]*\N*)\n)
+                       ((?s)(\s*\n|\s*//\N*\n|\s*/\*.*?\*/\s*\n)*)
+                       \Z,x) {
         skipping($fname, "can't find end of header guard");
         next;
     }
     $body = $1;
     my $line3 = $3;
     my $endif_comment = $4;
+    my $post = $5;
 
     my $oldg = $guard;
 
@@ -186,14 +188,14 @@ for my $fname (@ARGV) {
         my $newl1 = "#ifndef $guard\n";
         my $newl2 = "#define $guard\n";
         my $newl3 = "#endif\n";
-        $newl3 =~ s,\Z, /* $guard */, if defined $endif_comment;
+        $newl3 =~ s,\Z, /* $guard */, if $endif_comment;
         if ($line1 ne $newl1 or $line2 ne $newl2 or $line3 ne $newl3) {
             $pre =~ s/\n*\Z/\n\n/ if $pre =~ /\N/;
             $body =~ s/\A\n*/\n/;
             if ($opt_n) {
                 print "$fname would be cleaned up\n" if $opt_v;
             } else {
-                unslurp($fname, "$pre$newl1$newl2$body$newl3");
+                unslurp($fname, "$pre$newl1$newl2$body$newl3$post");
                 print "$fname cleaned up\n" if $opt_v;
             }
         }
diff --git a/scripts/modules/module_block.py b/scripts/modules/module_block.py
index 3f73007640..08646af92c 100644
--- a/scripts/modules/module_block.py
+++ b/scripts/modules/module_block.py
@@ -68,8 +68,6 @@ def print_top(fheader):
     fheader.write('''#ifndef QEMU_MODULE_BLOCK_H
 #define QEMU_MODULE_BLOCK_H
 
-#include "qemu-common.h"
-
 static const struct {
     const char *format_name;
     const char *protocol_name;
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 6d66bf6aa3..b929e07be4 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -249,8 +249,6 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
         visit = self._module_basename('qapi-visit', name)
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qemu/module.h"
 #include "qapi/visitor.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qobject-output-visitor.h"
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index 2067660be4..b732581046 100644
--- a/scripts/qapi/events.py
+++ b/scripts/qapi/events.py
@@ -148,7 +148,6 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
         visit = self._module_basename('qapi-visit', name)
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "%(prefix)sqapi-emit-events.h"
 #include "%(events)s.h"
 #include "%(visit)s.h"
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 826b8066e1..fd356151d2 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -287,7 +287,6 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
         self._add_system_module(None, ' * Built-in QAPI visitors')
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qapi/qapi-builtin-visit.h"
 '''))
@@ -303,7 +302,6 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
         visit = self._module_basename('qapi-visit', name)
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "%(visit)s.h"
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index e06f0f27c5..338a2365ee 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -22,7 +22,6 @@ def generate(events, backend, group):
         '#ifndef TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
         '#define TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
         '',
-        '#include "qemu-common.h"',
         '#include "trace/control.h"',
         '')
 
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index 79aa63eada..1b3522a716 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -52,7 +52,6 @@ def generate(events, backend, group):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
         '#include "qemu/osdep.h"',
-        '#include "qemu-common.h"',
         '#include "cpu.h"',
         '#include "exec/helper-proto.h"',
         '#include "%s"' % header,
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index 4e95e9b3f9..b14054ac01 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -37,7 +37,6 @@ def generate(events, backend, group):
         '     defined(TRACEPOINT_HEADER_MULTI_READ)',
         '#define TRACE_%s_GENERATED_UST_H' % group.upper(),
         '',
-        '#include "qemu-common.h"',
         '#include <lttng/tracepoint.h>',
         '',
         '/*',