Reviewers: Jakob,
Message:
PTAL. Delete .cpplint-cache before testing.
Description:
Parallelize cpplint in presubmit and fix usage of DISALLOW_* macros.
BUG=v8:1653
Please review this at http://codereview.chromium.org/9192010/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/full-codegen.h
M src/heap.h
M src/isolate.h
M src/objects.h
M src/platform-cygwin.cc
M src/platform-freebsd.cc
M src/platform-linux.cc
M src/platform-macos.cc
M src/platform-openbsd.cc
M src/platform-solaris.cc
M src/platform-win32.cc
M src/serialize.h
M tools/presubmit.py
Index: src/full-codegen.h
diff --git a/src/full-codegen.h b/src/full-codegen.h
index
a1368c251b03d3bc0d5127d12a474ea22e3a2c20..0270e13a1d6d444e4a8fefa2b64899b3df69dd26
100644
--- a/src/full-codegen.h
+++ b/src/full-codegen.h
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -142,11 +142,13 @@ class FullCodeGenerator: public AstVisitor {
return previous_;
}
- protected:
+ protected:
MacroAssembler* masm() { return codegen_->masm(); }
FullCodeGenerator* codegen_;
NestedStatement* previous_;
+
+ private:
DISALLOW_COPY_AND_ASSIGN(NestedStatement);
};
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
937b034e22bb0655f350c6f04299cfc967103c4d..f28a791aaf03acd957f3eef19b53381ea23f6b2e
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -2613,6 +2613,7 @@ class PathTracer : public ObjectVisitor {
AssertNoAllocation no_alloc; // i.e. no gc allowed.
+ private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
};
#endif // DEBUG || LIVE_OBJECT_LIST
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index
89793f8c74a0005ffde50b829639825cfa3b2303..7e6807b0a9d3a28538a21a57839419fbb286d7db
100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1071,6 +1071,7 @@ class Isolate {
Isolate* previous_isolate;
EntryStackItem* previous_item;
+ private:
DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
};
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
0d5bec546c301422b6871551f917f633d3c8379d..f2e35a6b7c422cbaca13a4a8cbb89861ea1f1204
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -7806,7 +7806,8 @@ class TemplateInfo: public Struct {
static const int kTagOffset = HeapObject::kHeaderSize;
static const int kPropertyListOffset = kTagOffset + kPointerSize;
static const int kHeaderSize = kPropertyListOffset +
kPointerSize;
- protected:
+
+ private:
DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateInfo);
};
Index: src/platform-cygwin.cc
diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc
index
f4c20ae2cc4f58641cc64acb0d81d09cc76b2600..c27e3c982f6540ddfe729496c2a27bf5593bae58
100644
--- a/src/platform-cygwin.cc
+++ b/src/platform-cygwin.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -722,6 +722,7 @@ class SamplerThread : public Thread {
static Mutex* mutex_;
static SamplerThread* instance_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SamplerThread);
};
Index: src/platform-freebsd.cc
diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc
index
65bd7201319c3a1213c3041313f14a2db738e20a..6d04fb1aaa95ff5b2852ba29d2cef9be4c7f1613
100644
--- a/src/platform-freebsd.cc
+++ b/src/platform-freebsd.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -840,6 +840,7 @@ class SignalSender : public Thread {
static bool signal_handler_installed_;
static struct sigaction old_signal_handler_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SignalSender);
};
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index
5a1c0d141561e7c0fdb55be141fd711fb3c7b78f..30b6086616564402f1246ea80136fb49da935aab
100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -1178,6 +1178,7 @@ class SignalSender : public Thread {
static bool signal_handler_installed_;
static struct sigaction old_signal_handler_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SignalSender);
};
Index: src/platform-macos.cc
diff --git a/src/platform-macos.cc b/src/platform-macos.cc
index
369c3e4034a1438d33edc0e37e43834349ed0115..9f8fe1209fffa97edd6c59698b1418860ea3ca49
100644
--- a/src/platform-macos.cc
+++ b/src/platform-macos.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -854,6 +854,7 @@ class SamplerThread : public Thread {
static Mutex* mutex_;
static SamplerThread* instance_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SamplerThread);
};
Index: src/platform-openbsd.cc
diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc
index
a01c08df50046ab9b4ee1963b36dda414798910f..fda5fb45895be91fecc6c22bf4b545cbc62bb983
100644
--- a/src/platform-openbsd.cc
+++ b/src/platform-openbsd.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -923,6 +923,7 @@ class SignalSender : public Thread {
static bool signal_handler_installed_;
static struct sigaction old_signal_handler_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SignalSender);
};
Index: src/platform-solaris.cc
diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc
index
08bec93964e6a5679762fbcdd8cafb3a0dc016c9..67668e55e50431d398d8f17fae34c3ef0f1dede7
100644
--- a/src/platform-solaris.cc
+++ b/src/platform-solaris.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -759,6 +759,7 @@ class SignalSender : public Thread {
static bool signal_handler_installed_;
static struct sigaction old_signal_handler_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SignalSender);
};
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index
5c000e630aceeacb6517d144d65ab38658a0a1f2..ffda6606a890f0004652335bbb99794d7b786a20
100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -2006,6 +2006,7 @@ class SamplerThread : public Thread {
static Mutex* mutex_;
static SamplerThread* instance_;
+ private:
DISALLOW_COPY_AND_ASSIGN(SamplerThread);
};
Index: src/serialize.h
diff --git a/src/serialize.h b/src/serialize.h
index
6efb8ee1d7c8774450b0876fac345a6544741c95..839bfc5618cc33c04b96a8d900c9e97c5b99291a
100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -1,4 +1,4 @@
-// Copyright 2006-2009 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -581,6 +581,7 @@ class Serializer : public SerializerDeserializer {
friend class ObjectSerializer;
friend class Deserializer;
+ private:
DISALLOW_COPY_AND_ASSIGN(Serializer);
};
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index
7af6e3d0d80e3a85c7606af692c8b1c249e78922..8619a2536d9bc517a657b6f9a6315783c19ffe2b
100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 the V8 project authors. All rights reserved.
+# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
@@ -42,6 +42,7 @@ import pickle
import re
import sys
import subprocess
+import multiprocessing
from subprocess import PIPE
# Disabled LINT rules and reason.
@@ -101,6 +102,33 @@ whitespace/todo
""".split()
+LINT_OUTPUT_PATTERN = re.compile(r'^.+[:(]\d+[:)]|^Done processing')
+
+
+def CppLintWorker(command):
+ try:
+ process = subprocess.Popen(command, stderr=subprocess.PIPE)
+ process.wait()
+ out_lines = ""
+ error_count = -1
+ while True:
+ out_line = process.stderr.readline()
+ if out_line == '' and process.poll() != None:
+ break
+ m = LINT_OUTPUT_PATTERN.match(out_line)
+ if m:
+ out_lines += out_line
+ error_count += 1
+ sys.stderr.write(out_lines)
+ return error_count
+ except KeyboardInterrupt:
+ child.kill()
+ except:
+ print('Error running cpplint.py. Please make sure you have
depot_tools' +
+ ' in your $PATH. Lint check skipped.')
+ child.kill()
+
+
class FileContentsCache(object):
def __init__(self, sums_file_name):
@@ -206,29 +234,26 @@ class CppLintProcessor(SourceFileProcessor):
return True
filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES])
- command = ['cpplint.py', '--filter', filt] + join(files)
+ command = ['cpplint.py', '--filter', filt]
local_cpplint = join(path, "tools", "cpplint.py")
if exists(local_cpplint):
- command = ['python', local_cpplint, '--filter', filt] + join(files)
+ command = ['python', local_cpplint, '--filter', filt]
+ commands = join([command + [file] for file in files])
+ count = multiprocessing.cpu_count()
+ pool = multiprocessing.Pool(count)
try:
- process = subprocess.Popen(command, stderr=subprocess.PIPE)
- except:
- print('Error running cpplint.py. Please make sure you have
depot_tools' +
- ' in your $PATH. Lint check skipped.')
- return True
- LINT_ERROR_PATTERN = re.compile(r'^(.+)[:(]\d+[:)]')
- while True:
- out_line = process.stderr.readline()
- if out_line == '' and process.poll() != None:
- break
- sys.stderr.write(out_line)
- m = LINT_ERROR_PATTERN.match(out_line)
- if m:
- good_files_cache.RemoveFile(m.group(1))
+ results = pool.map(CppLintWorker, commands)
+ except KeyboardInterrupt:
+ print "\nCaught KeyboardInterrupt, terminating workers."
+ sys.exit(1)
+
+ for i in range(len(files)):
+ if results[i] > 0:
+ good_files_cache.RemoveFile(files[i])
+ print "Total errors found: %d" % sum(results)
good_files_cache.Save()
- return process.returncode == 0
COPYRIGHT_HEADER_PATTERN = re.compile(
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev