You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/06/27 22:47:58 UTC

[1/3] mesos git commit: Replaced new instances of `NULL` with `nullptr`.

Repository: mesos
Updated Branches:
  refs/heads/master 6a883b277 -> df18e4e36


Replaced new instances of `NULL` with `nullptr`.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/df18e4e3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/df18e4e3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/df18e4e3

Branch: refs/heads/master
Commit: df18e4e365cadce1632ea23d599c1eba83b4ff75
Parents: 6a04428
Author: Michael Park <mp...@apache.org>
Authored: Mon Jun 27 15:30:37 2016 +0200
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jun 28 00:39:17 2016 +0200

----------------------------------------------------------------------
 src/authorizer/local/authorizer.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/df18e4e3/src/authorizer/local/authorizer.cpp
----------------------------------------------------------------------
diff --git a/src/authorizer/local/authorizer.cpp b/src/authorizer/local/authorizer.cpp
index 2c20a30..3fade41 100644
--- a/src/authorizer/local/authorizer.cpp
+++ b/src/authorizer/local/authorizer.cpp
@@ -260,11 +260,11 @@ public:
         case authorization::ACCESS_SANDBOX: {
           aclObject.set_type(mesos::ACL::Entity::ANY);
 
-          if (object->executor_info != NULL &&
+          if (object->executor_info != nullptr &&
               object->executor_info->command().has_user()) {
             aclObject.add_values(object->executor_info->command().user());
             aclObject.set_type(mesos::ACL::Entity::SOME);
-          } else if (object->framework_info != NULL) {
+          } else if (object->framework_info != nullptr) {
             aclObject.add_values(object->framework_info->user());
             aclObject.set_type(mesos::ACL::Entity::SOME);
           }


[2/3] mesos git commit: Update C++ style checker to prevent `NULL` usage.

Posted by mp...@apache.org.
Update C++ style checker to prevent `NULL` usage.

Review: https://reviews.apache.org/r/48320/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6a04428f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6a04428f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6a04428f

Branch: refs/heads/master
Commit: 6a04428f24a07e86dcee8cff66d9536c6d6dfc18
Parents: 470c6cc
Author: Tomasz Janiszewski <ja...@gmail.com>
Authored: Mon Jun 27 15:24:34 2016 +0200
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jun 28 00:39:17 2016 +0200

----------------------------------------------------------------------
 support/cpplint.patch  | 34 +++++++++++++++++++++++++++-------
 support/cpplint.py     |  6 ++++++
 support/mesos-style.py |  1 +
 3 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6a04428f/support/cpplint.patch
----------------------------------------------------------------------
diff --git a/support/cpplint.patch b/support/cpplint.patch
index 56939df..1b4d4ee 100644
--- a/support/cpplint.patch
+++ b/support/cpplint.patch
@@ -1,18 +1,27 @@
 diff --git a/support/cpplint.py b/support/cpplint.py
-index 2ad644e..96e7fbc 100644
+index 2ad644e..5c5fd99 100644
 --- a/support/cpplint.py
 +++ b/support/cpplint.py
-@@ -29,6 +29,9 @@
+@@ -29,6 +29,10 @@
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  # Modified by Adam B (adam@mesosphere.io) to handle hpp files.
 +# Modified by Avinash S (avinash@mesosphere.io) to check for at least
 +# a __single__ space in comments is required for hpp and cpp files.
++# Modified by Tomek J (janiszt@gmail.com) to check for NULL usage.
 +
 
  """Does google-lint on c++ files.
 
-@@ -1777,16 +1780,16 @@ class _NamespaceInfo(_BlockInfo):
+@@ -153,6 +157,7 @@ _ERROR_CATEGORIES = [
+   'build/include_order',
+   'build/include_what_you_use',
+   'build/namespaces',
++  'build/nullptr',
+   'build/printf_format',
+   'build/storage_class',
+   'legal/copyright',
+@@ -1777,16 +1782,16 @@ class _NamespaceInfo(_BlockInfo):
      if self.name:
        # Named namespace
        if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
@@ -33,7 +42,7 @@ index 2ad644e..96e7fbc 100644
 
 
  class _PreprocessorInfo(object):
-@@ -1995,11 +1998,9 @@ class _NestingState(object):
+@@ -1995,11 +2000,9 @@ class _NestingState(object):
        if access_match:
          classinfo.access = access_match.group(2)
 
@@ -47,7 +56,7 @@ index 2ad644e..96e7fbc 100644
            if classinfo.is_struct:
              parent = 'struct ' + classinfo.name
            else:
-@@ -2008,7 +2009,7 @@ class _NestingState(object):
+@@ -2008,7 +2011,7 @@ class _NestingState(object):
            if access_match.group(3):
              slots = access_match.group(3)
            error(filename, linenum, 'whitespace/indent', 3,
@@ -56,7 +65,7 @@ index 2ad644e..96e7fbc 100644
                      access_match.group(2), slots, parent))
 
      # Consume braces or semicolons from what's left of the line
-@@ -2637,13 +2638,10 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
+@@ -2637,13 +2640,10 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
      if (line.count('"', 0, commentpos) -
          line.count('\\"', 0, commentpos)) % 2 == 0:   # not in quotes
        # Allow one space for new scopes, two spaces otherwise:
@@ -73,7 +82,7 @@ index 2ad644e..96e7fbc 100644
        # There should always be a space between the // and the comment
        commentend = commentpos + 2
        if commentend < len(line) and not line[commentend] == ' ':
-@@ -2694,11 +2692,11 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
+@@ -2694,11 +2694,11 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
            'Missing spaces around %s' % match.group(1))
    # We allow no-spaces around << when used like this: 10<<20, but
    # not otherwise (particularly, not when used as streams)
@@ -87,3 +96,14 @@ index 2ad644e..96e7fbc 100644
      error(filename, linenum, 'whitespace/operators', 3,
            'Missing spaces around <<')
    elif not Match(r'#.*include', line):
+@@ -3441,6 +3441,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)
+   CheckEmptyBlockBody(filename, clean_lines, linenum, error)

http://git-wip-us.apache.org/repos/asf/mesos/blob/6a04428f/support/cpplint.py
----------------------------------------------------------------------
diff --git a/support/cpplint.py b/support/cpplint.py
index 96e7fbc..5c5fd99 100644
--- a/support/cpplint.py
+++ b/support/cpplint.py
@@ -31,6 +31,7 @@
 # Modified by Adam B (adam@mesosphere.io) to handle hpp files.
 # Modified by Avinash S (avinash@mesosphere.io) to check for at least
 # a __single__ space in comments is required for hpp and cpp files.
+# Modified by Tomek J (janiszt@gmail.com) to check for NULL usage.
 
 
 """Does google-lint on c++ files.
@@ -156,6 +157,7 @@ _ERROR_CATEGORIES = [
   'build/include_order',
   'build/include_what_you_use',
   'build/namespaces',
+  'build/nullptr',
   'build/printf_format',
   'build/storage_class',
   'legal/copyright',
@@ -3439,6 +3441,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)
   CheckEmptyBlockBody(filename, clean_lines, linenum, error)

http://git-wip-us.apache.org/repos/asf/mesos/blob/6a04428f/support/mesos-style.py
----------------------------------------------------------------------
diff --git a/support/mesos-style.py b/support/mesos-style.py
index 35ef786..061cbe7 100755
--- a/support/mesos-style.py
+++ b/support/mesos-style.py
@@ -45,6 +45,7 @@ def run_lint(source_paths):
         'build/class',
         'build/deprecated',
         'build/endif_comment',
+        'build/nullptr',
         'readability/todo',
         'readability/namespace',
         'runtime/vlog',


[3/3] mesos git commit: Updated support/cpplint.patch.

Posted by mp...@apache.org.
Updated support/cpplint.patch.

Generated `support/cpplint.patch` using following command:

```
PATCH="support/cpplint.patch"
FIRST_COMMIT=\`git log --pretty=format:"%h"  --diff-filter=A -- $PATCH\`
git diff ${FIRST_COMMIT}..master  support/cpplint.py > $PATCH
sed -i 's/\[ \\t\]\*$//' "$PATCH"
```

Review: https://reviews.apache.org/r/48728/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/470c6cc1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/470c6cc1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/470c6cc1

Branch: refs/heads/master
Commit: 470c6cc19011728b81e133a75957b1d47090504f
Parents: 6a883b2
Author: Tomasz Janiszewski <ja...@gmail.com>
Authored: Mon Jun 27 15:24:23 2016 +0200
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jun 28 00:39:17 2016 +0200

----------------------------------------------------------------------
 support/cpplint.patch | 114 +++++++++++++++++++--------------------------
 1 file changed, 47 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/470c6cc1/support/cpplint.patch
----------------------------------------------------------------------
diff --git a/support/cpplint.patch b/support/cpplint.patch
index 1dd69a0..56939df 100644
--- a/support/cpplint.patch
+++ b/support/cpplint.patch
@@ -1,33 +1,18 @@
---- support/cpplint.py.orig	2014-07-16 15:35:35.000000000 -0700
-+++ support/cpplint.py	2014-07-16 15:57:34.000000000 -0700
-@@ -28,6 +28,8 @@
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+diff --git a/support/cpplint.py b/support/cpplint.py
+index 2ad644e..96e7fbc 100644
+--- a/support/cpplint.py
++++ b/support/cpplint.py
+@@ -29,6 +29,9 @@
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
-+# Modified by Adam B (adam@mesosphere.io) to handle hpp files.
+
+ # Modified by Adam B (adam@mesosphere.io) to handle hpp files.
++# Modified by Avinash S (avinash@mesosphere.io) to check for at least
++# a __single__ space in comments is required for hpp and cpp files.
 +
+
  """Does google-lint on c++ files.
- 
- The goal of this script is to identify places in the code that *may*
-@@ -71,7 +73,7 @@
-   suppresses errors of all categories on that line.
- 
-   The files passed in will be linted; at least one file must be provided.
--  Default linted extensions are .cc, .cpp, .cu, .cuh and .h.  Change the
-+  Default linted extensions are .cc, .cpp, .cu, .cuh, .hpp and .h.  Change the
-   extensions with the --extensions flag.
- 
-   Flags:
-@@ -449,7 +451,7 @@
- 
- # 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'])
- 
- def ParseNolintSuppressions(filename, raw_line, linenum, error):
-   """Updates the global list of error-suppressions.
-@@ -1775,16 +1777,16 @@
+
+@@ -1777,16 +1780,16 @@ class _NamespaceInfo(_BlockInfo):
      if self.name:
        # Named namespace
        if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
@@ -48,10 +33,10 @@
 
 
  class _PreprocessorInfo(object):
-@@ -1993,11 +1995,9 @@
+@@ -1995,11 +1998,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.
@@ -62,48 +47,43 @@
            if classinfo.is_struct:
              parent = 'struct ' + classinfo.name
            else:
-@@ -2006,7 +2006,7 @@
+@@ -2008,7 +2009,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
-@@ -3400,7 +3400,7 @@
- 
-   # Check if the line is a header guard.
-   is_header_guard = False
--  if file_extension == 'h':
-+  if (file_extension == 'h' or file_extension == 'hpp'):
-     cppvar = GetHeaderGuardCPPVariable(filename)
-     if (line.startswith('#ifndef %s' % cppvar) or
-         line.startswith('#define %s' % cppvar) or
-@@ -3867,7 +3867,7 @@
-     error(filename, linenum, 'runtime/init', 4,
-           'You seem to be initializing a member variable with itself.')
- 
--  if file_extension == 'h':
-+  if (file_extension == 'h' or file_extension == 'hpp'):
-     # TODO(unknown): check that 1-arg constructors are explicit.
-     #                How to tell it's a constructor?
-     #                (handled in CheckForNonStandardConstructs for now)
-@@ -4011,7 +4011,7 @@
-   # Check for use of unnamed namespaces in header files.  Registration
-   # macros are typically OK, so we allow use of "namespace {" on lines
-   # that end with backslashes.
--  if (file_extension == 'h'
-+  if ((file_extension == 'h' or file_extension == 'hpp')
-       and Search(r'\bnamespace\s*{', line)
-       and line[-1] != '\\'):
-     error(filename, linenum, 'build/namespaces', 4,
-@@ -4552,7 +4552,7 @@
- 
-   CheckForCopyright(filename, lines, error)
- 
--  if file_extension == 'h':
-+  if (file_extension == 'h' or file_extension == 'hpp'):
-     CheckForHeaderGuard(filename, lines, error)
- 
-   RemoveMultiLineComments(filename, lines, error)
+@@ -2637,13 +2638,10 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
+     if (line.count('"', 0, commentpos) -
+         line.count('\\"', 0, commentpos)) % 2 == 0:   # not in quotes
+       # Allow one space for new scopes, two spaces otherwise:
+-      if (not Match(r'^\s*{ //', line) 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')
+       # There should always be a space between the // and the comment
+       commentend = commentpos + 2
+       if commentend < len(line) and not line[commentend] == ' ':
+@@ -2694,11 +2692,11 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
+           'Missing spaces around %s' % match.group(1))
+   # We allow no-spaces around << when used like this: 10<<20, but
+   # not otherwise (particularly, not when used as streams)
+-  # Also ignore using ns::operator<<;
++  # Also ignore 'operator<<'.
+   match = Search(r'(operator|\S)(?:L|UL|ULL|l|ul|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 <<')
+   elif not Match(r'#.*include', line):