|
From: <sv...@va...> - 2015-09-30 20:58:42
|
Author: florian
Date: Wed Sep 30 21:58:36 2015
New Revision: 15694
Log:
Beef up the check_headers_and_includes script to make sure
every assembler file instantiates MARK_STACK_NO_EXEC unconditionally.
Modified:
trunk/tests/check_headers_and_includes
Modified: trunk/tests/check_headers_and_includes
==============================================================================
--- trunk/tests/check_headers_and_includes (original)
+++ trunk/tests/check_headers_and_includes Wed Sep 30 21:58:36 2015
@@ -14,6 +14,10 @@
# (7) include/*.h and tool *.[ch] must not use vg_assert
# (8) coregrind/ *.[ch] must not use VG_(tool_panic)
# (9) include/*.h and tool *.[ch] must not use VG_(core_panic)
+# (10) *.S must unconditionally instantiate MARK_STACK_NO_EXEC
+#
+# There can be false positives as we don't really parse the source files.
+# Instead we only match regular expressions.
#-------------------------------------------------------------------
use strict;
@@ -144,8 +148,8 @@
next;
}
-# Regular files; only interested in *.c and *.h
- next if (! ($file =~ /\.[ch]$/));
+# Regular files; only interested in *.c, *.S and *.h
+ next if (! ($file =~ /\.[cSh]$/));
my $path_name = defined $path ? "$path/$file" : $file;
process_file($path_name);
}
@@ -306,6 +310,36 @@
}
}
+#---------------------------------------------------------------------
+# Check an assembler file
+#---------------------------------------------------------------------
+sub check_assembler_file {
+ my ($path_name) = @_;
+ my $file = basename($path_name);
+ my $found = 0;
+
+ open(FILE, "<$file") || die "Cannot open file '$file'";
+
+ while (my $line = <FILE>) {
+ if ($line =~ /^\s*MARK_STACK_NO_EXEC/) {
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0) {
+ error("File $path_name does not instantiate MARK_STACK_NO_EXEC\n");
+ } else {
+ while (my $line = <FILE>) {
+ if ($line =~ /^\s*#\s*endif/) {
+ error("File $path_name instantiates MARK_STACK_NO_EXEC"
+ . " under a condition\n");
+ last;
+ }
+ }
+ }
+ close FILE;
+}
+
sub process_file {
my ($path_name) = @_;
@@ -318,6 +352,10 @@
} elsif (is_tool_file($path_name)) {
check_tool_file($path_name);
}
+
+ if ($path_name =~ /\.S$/) {
+ check_assembler_file($path_name);
+ }
}
sub error {
|