[
https://issues.apache.org/jira/browse/MESOS-4451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114050#comment-15114050
]
Klaus Ma edited comment on MESOS-4451 at 1/24/16 12:11 AM:
-----------------------------------------------------------
I think we can introduce some static check tools before GCC fully support, e.g.
{{cppcheck}}; and add it as git hook. Here's the result when rollback
MESOS-4449.
{code}
Klauss-MacBook-Pro:mesos klaus$ cppcheck --enable=all src/slave/slave.cpp
Checking src/slave/slave.cpp...
[src/slave/slave.cpp:2112] -> [src/slave/slave.cpp:2111]: (warning) Either the
condition 'executor==0' is redundant or there is possible null pointer
dereference: executor.
Checking src/slave/slave.cpp: __WINDOWS__...
Checking src/slave/slave.cpp: __linux__...
(information) Cppcheck cannot find all the include files (use --check-config
for details)
Klauss-MacBook-Pro:mesos klaus$ vim src/slave/slave.cpp
{code}
was (Author: klaus1982):
I think we can introduce some static check tools before GCC fully support, e.g.
{{cppcheck}}; and add it as git hook. Here's the result when rollback
MESOS-4449.
{{code}}
Klauss-MacBook-Pro:mesos klaus$ cppcheck --enable=all src/slave/slave.cpp
Checking src/slave/slave.cpp...
[src/slave/slave.cpp:2112] -> [src/slave/slave.cpp:2111]: (warning) Either the
condition 'executor==0' is redundant or there is possible null pointer
dereference: executor.
Checking src/slave/slave.cpp: __WINDOWS__...
Checking src/slave/slave.cpp: __linux__...
(information) Cppcheck cannot find all the include files (use --check-config
for details)
Klauss-MacBook-Pro:mesos klaus$ vim src/slave/slave.cpp
{{code}}
> Enable `-Wnull-dereference` when building Mesos
> -----------------------------------------------
>
> Key: MESOS-4451
> URL: https://issues.apache.org/jira/browse/MESOS-4451
> Project: Mesos
> Issue Type: Task
> Components: build
> Reporter: Anand Mazumdar
> Priority: Minor
> Labels: mesosphere
>
> Currently we don't have {{-Wnull-dereference}} enabled for Mesos. This can
> sometimes lead to {{NULL}} dereference errors that go unnoticed like the one
> reported in {{MESOS-4449}}.
> We do have {{-Werror}} set to {{-Wall}} but this particular warning is not
> included in {{-Wall}}.
> This flag has been recently introduced in {{GCC 5.3.0+}}. However, {{clang
> 3.5+}} have had this for some time now. For now, one possible option would be
> to selectively enable this for clang.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)