This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 309bf809fe61ee0d9fa1a53f609acc708855b5ef
Author: Benjamin Bannier <[email protected]>
AuthorDate: Sat Mar 2 22:59:53 2019 +0100

    Removed `support/cpplint.patch`.
    
    This change removes explicit tracking of a patch against upstream
    cpplint in the tree and replaces it with a clear reference against the
    upstream repository and revision used in the modified file.
    
    The patch was never used by us against any upstream version, and was
    not e.g., a legal requirement. The process around creating the patch
    was cumbersome and error prone. Removing the patch from the tree
    should not only make it easier to evolve our modifications going
    forward, but also remove a lot of noise from changes.
    
    Review: https://reviews.apache.org/r/70098
---
 support/cpplint.patch | 201 --------------------------------------------------
 support/cpplint.py    |   5 ++
 2 files changed, 5 insertions(+), 201 deletions(-)

diff --git a/support/cpplint.patch b/support/cpplint.patch
deleted file mode 100644
index 2427be8..0000000
--- a/support/cpplint.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-diff --git a/support/cpplint.py b/support/cpplint.py
-index 6d44d3165..b8b3b1a14 100644
---- a/support/cpplint.py
-+++ b/support/cpplint.py
-@@ -28,6 +28,13 @@
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-+# Modified by Adam B ([email protected]) to handle hpp files.
-+# Modified by Avinash S ([email protected]) to check for at least
-+# a __single__ space in comments is required for hpp and cpp files.
-+# Modified by Tomek J ([email protected]) to check for NULL usage.
-+# Modified by Armand G ([email protected]) to skip file when linted
-+# and to not print anything if there is no error.
-+
- """Does google-lint on c++ files.
-
- The goal of this script is to identify places in the code that *may*
-@@ -40,6 +47,7 @@ In particular, we can get very confused by /* and // inside 
strings!
- We do a small hack, which is to ignore //'s with "'s after them on the
- same line, but it is far from perfect (in either direction).
- """
-+# pylint: skip-file
-
- import codecs
- import copy
-@@ -57,6 +65,24 @@ try:
-   xrange          # Python 2
- except NameError:
-   xrange = range  # Python 3
-+  unicode = str
-+  def iteritems(d):
-+    return d.items()
-+  def itervalues(d):
-+    return d.values()
-+else:
-+  # Python 2
-+  def iteritems(d):
-+    return d.iteritems()
-+  def itervalues(d):
-+    return d.itervalues()
-+  # Change stderr to write with replacement characters so we don't die
-+  # if we try to print something containing non-ASCII characters.
-+  sys.stderr = codecs.StreamReaderWriter(sys.stderr,
-+                                         codecs.getreader('utf8'),
-+                                         codecs.getwriter('utf8'),
-+                                         'replace')
-+
-
-
- _USAGE = """
-@@ -216,6 +242,7 @@ _ERROR_CATEGORIES = [
-     'build/include_order',
-     'build/include_what_you_use',
-     'build/namespaces',
-+    'build/nullptr',
-     'build/printf_format',
-     'build/storage_class',
-     'legal/copyright',
-@@ -558,7 +585,7 @@ _line_length = 80
-
- # The allowed extensions for file names
- # This is set by --extensions flag.
--_valid_extensions = set(['cc', 'h', 'cpp', 'cu', 'cuh'])
-+_valid_extensions = set(['cc', 'h', 'cpp', 'cu', 'cuh', 'hpp'])
-
- # Treat all headers starting with 'h' equally: .h, .hpp, .hxx etc.
- # This is set by --headers flag.
-@@ -952,10 +979,11 @@ class _CppLintState(object):
-
-   def PrintErrorCounts(self):
-     """Print a summary of errors by category, and the total."""
--    for category, count in self.errors_by_category.iteritems():
-+    for category, count in iteritems(self.errors_by_category):
-       sys.stderr.write('Category \'%s\' errors found: %d\n' %
-                        (category, count))
--    sys.stdout.write('Total errors found: %d\n' % self.error_count)
-+    if self.error_count > 0:
-+      sys.stdout.write('Total errors found: %d\n' % self.error_count)
-
- _cpplint_state = _CppLintState()
-
-@@ -2370,14 +2398,14 @@ class _NamespaceInfo(_BlockInfo):
-     if self.name:
-       # Named namespace
-       if not Match((r'^\s*};*\s*(//|/\*).*\bnamespace\s+' +
--                    re.escape(self.name) + r'[\*/\.\\\s]*$'),
-+                    re.escape(self.name) + r'[\*/\.\\\s]* {$'),
-                    line):
-         error(filename, linenum, 'readability/namespace', 5,
--              'Namespace should be terminated with "// namespace %s"' %
-+              'Namespace should be terminated with "// namespace %s {"' %
-               self.name)
-     else:
-       # Anonymous namespace
--      if not Match(r'^\s*};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
-+      if not Match(r'^\s*};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]* {$', line):
-         # If "// namespace anonymous" or "// anonymous namespace (more text)",
-         # mention "// anonymous namespace" as an acceptable form
-         if Match(r'^\s*}.*\b(namespace anonymous|anonymous namespace)\b', 
line):
-@@ -2386,7 +2414,7 @@ class _NamespaceInfo(_BlockInfo):
-                 ' or "// anonymous namespace"')
-         else:
-           error(filename, linenum, 'readability/namespace', 5,
--                'Anonymous namespace should be terminated with "// 
namespace"')
-+                'Anonymous namespace should be terminated with "// namespace 
{"')
-
-
- class _PreprocessorInfo(object):
-@@ -2688,11 +2716,9 @@ class NestingState(object):
-       if access_match:
-         classinfo.access = access_match.group(2)
-
--        # Check that access keywords are indented +1 space.  Skip this
--        # check if the keywords are not preceded by whitespaces.
-+        # Check that access keywords are not indented.
-         indent = access_match.group(1)
--        if (len(indent) != classinfo.class_indent + 1 and
--            Match(r'^\s*$', indent)):
-+        if (len(indent) != classinfo.class_indent):
-           if classinfo.is_struct:
-             parent = 'struct ' + classinfo.name
-           else:
-@@ -2701,7 +2727,7 @@ class NestingState(object):
-           if access_match.group(3):
-             slots = access_match.group(3)
-           error(filename, linenum, 'whitespace/indent', 3,
--                '%s%s: should be indented +1 space inside %s' % (
-+                '%s%s: should not be indented inside %s' % (
-                     access_match.group(2), slots, parent))
-
-     # Consume braces or semicolons from what's left of the line
-@@ -3129,13 +3155,10 @@ def CheckComment(line, filename, linenum, 
next_line_start, error):
-     # Check if the // may be in quotes.  If so, ignore it
-     if re.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0:
-       # Allow one space for new scopes, two spaces otherwise:
--      if (not (Match(r'^.*{ *//', line) and next_line_start == commentpos) and
--          ((commentpos >= 1 and
--            line[commentpos-1] not in string.whitespace) or
--           (commentpos >= 2 and
--            line[commentpos-2] not in string.whitespace))):
-+      if (commentpos >= 1 and
-+            line[commentpos-1] not in string.whitespace):
-         error(filename, linenum, 'whitespace/comments', 2,
--              'At least two spaces is best between code and comments')
-+              'At least a single space is required between code and comments')
-
-       # Checks for common mistakes in TODO comments.
-       comment = line[commentpos:]
-@@ -3383,7 +3406,7 @@ def CheckOperatorSpacing(filename, clean_lines, linenum, 
error):
-   # those tend to be macros that deal with operators.
-   match = 
Search(r'(operator|[^\s(<])(?:L|UL|LL|ULL|l|ul|ll|ull)?<<([^\s,=<])', line)
-   if (match and not (match.group(1).isdigit() and match.group(2).isdigit()) 
and
--      not (match.group(1) == 'operator' and match.group(2) == ';')):
-+      not (match.group(1) == 'operator')):
-     error(filename, linenum, 'whitespace/operators', 3,
-           'Missing spaces around <<')
-
-@@ -4410,6 +4433,10 @@ def CheckStyle(filename, clean_lines, linenum, 
file_extension, nesting_state,
-     error(filename, linenum, 'whitespace/newline', 0,
-           'More than one command on the same line')
-
-+  if re.search(r'\bNULL\b', cleansed_line):
-+    error(filename, linenum, 'build/nullptr', 1,
-+          'NULL found; better to use nullptr')
-+
-   # Some more style checks
-   CheckBraces(filename, clean_lines, linenum, error)
-   CheckTrailingSemicolon(filename, clean_lines, linenum, error)
-@@ -4622,7 +4649,7 @@ def _GetTextInside(text, start_pattern):
-
-   # Give opening punctuations to get the matching close-punctuations.
-   matching_punctuation = {'(': ')', '{': '}', '[': ']'}
--  closing_punctuation = set(matching_punctuation.itervalues())
-+  closing_punctuation = set(itervalues(matching_punctuation))
-
-   # Find the position to start extracting text.
-   match = re.search(start_pattern, text, re.M)
-@@ -5570,7 +5597,7 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, 
include_state, error,
-
-   # include_dict is modified during iteration, so we iterate over a copy of
-   # the keys.
--  header_keys = include_dict.keys()
-+  header_keys = list(include_dict)
-   for header in header_keys:
-     (same_module, common_path) = FilesBelongToSameModule(abs_filename, header)
-     fullpath = common_path + header
-@@ -6223,13 +6250,6 @@ def ParseArguments(args):
- def main():
-   filenames = ParseArguments(sys.argv[1:])
-
--  # Change stderr to write with replacement characters so we don't die
--  # if we try to print something containing non-ASCII characters.
--  sys.stderr = codecs.StreamReaderWriter(sys.stderr,
--                                         codecs.getreader('utf8'),
--                                         codecs.getwriter('utf8'),
--                                         'replace')
--
-   _cpplint_state.ResetErrorCounts()
-   for filename in filenames:
-     ProcessFile(filename, _cpplint_state.verbose_level)
diff --git a/support/cpplint.py b/support/cpplint.py
index d3e7aaf..0227d32 100644
--- a/support/cpplint.py
+++ b/support/cpplint.py
@@ -28,6 +28,11 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+# This file was modified for use in Mesos from the upstream revision
+# `43d512ba130` from https://github.com/google/styleguide.git. To
+# review the currently made changes please perform a diff against the
+# specific upstream version.
+
 # Modified by Adam B ([email protected]) to handle hpp files.
 # Modified by Avinash S ([email protected]) to check for at least
 # a __single__ space in comments is required for hpp and cpp files.

Reply via email to