Commit 11e77918 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Parallelize cpplint in presubmit and fix usage of DISALLOW_* macros.

BUG=v8:1653

Review URL: https://chromiumcodereview.appspot.com/9192010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e9139ffa
// 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);
};
......
......@@ -2615,6 +2615,7 @@ class PathTracer : public ObjectVisitor {
AssertNoAllocation no_alloc; // i.e. no gc allowed.
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
};
#endif // DEBUG || LIVE_OBJECT_LIST
......
......@@ -1071,6 +1071,7 @@ class Isolate {
Isolate* previous_isolate;
EntryStackItem* previous_item;
private:
DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
};
......
......@@ -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);
};
......
// 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);
};
......
// 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);
};
......
......@@ -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);
};
......
// 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);
};
......
// 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);
};
......
// 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:
......@@ -843,6 +843,7 @@ class SignalSender : public Thread {
static bool signal_handler_installed_;
static struct sigaction old_signal_handler_;
private:
DISALLOW_COPY_AND_ASSIGN(SignalSender);
};
......
// 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);
};
......
// 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);
};
......
#!/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:
process.kill()
except:
print('Error running cpplint.py. Please make sure you have depot_tools' +
' in your $PATH. Lint check skipped.')
process.kill()
class FileContentsCache(object):
def __init__(self, sums_file_name):
......@@ -206,29 +234,28 @@ 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_async(CppLintWorker, commands).get(999999)
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])
total_errors = sum(results)
print "Total errors found: %d" % total_errors
good_files_cache.Save()
return process.returncode == 0
return total_errors == 0
COPYRIGHT_HEADER_PATTERN = re.compile(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment