зеркало из https://github.com/microsoft/caffe.git
Merge pull request #168 from jeffdonahue/fix-lint-bugs
Fix bugs introduced by lint
This commit is contained in:
Коммит
de4f7a419f
20
Makefile
20
Makefile
|
@ -32,8 +32,8 @@ TOOL_SRCS := $(shell find tools -name "*.cpp")
|
|||
EXAMPLE_SRCS := $(shell find examples -name "*.cpp")
|
||||
# PROTO_SRCS are the protocol buffer definitions
|
||||
PROTO_SRCS := $(wildcard src/$(PROJECT)/proto/*.proto)
|
||||
# NONGEN_CXX_SRCS includes all source/header files except those generated by
|
||||
# proto.
|
||||
# NONGEN_CXX_SRCS includes all source/header files except those generated
|
||||
# automatically (e.g., by proto).
|
||||
NONGEN_CXX_SRCS := $(shell find \
|
||||
src/$(PROJECT) \
|
||||
include/$(PROJECT) \
|
||||
|
@ -42,6 +42,8 @@ NONGEN_CXX_SRCS := $(shell find \
|
|||
examples \
|
||||
tools \
|
||||
-regex ".*\.\(cpp\|hpp\|cu\|cuh\)")
|
||||
LINT_REPORT := $(BUILD_DIR)/cpp_lint.log
|
||||
FAILED_LINT_REPORT := $(BUILD_DIR)/cpp_lint.error_log
|
||||
# PY$(PROJECT)_SRC is the python wrapper for $(PROJECT)
|
||||
PY$(PROJECT)_SRC := python/$(PROJECT)/py$(PROJECT).cpp
|
||||
PY$(PROJECT)_SO := python/$(PROJECT)/py$(PROJECT).so
|
||||
|
@ -105,7 +107,7 @@ PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library))
|
|||
##############################
|
||||
# Define build targets
|
||||
##############################
|
||||
.PHONY: all init test clean linecount tools examples py mat distribute py$(PROJECT) mat$(PROJECT) proto
|
||||
.PHONY: all init test clean linecount lint tools examples py mat distribute py$(PROJECT) mat$(PROJECT) proto
|
||||
|
||||
all: init $(NAME) $(STATIC_NAME) tools examples
|
||||
@echo $(CXX_OBJS)
|
||||
|
@ -120,8 +122,16 @@ init:
|
|||
linecount: clean
|
||||
cloc --read-lang-def=$(PROJECT).cloc src/$(PROJECT)/
|
||||
|
||||
lint:
|
||||
./scripts/cpp_lint.py $(NONGEN_CXX_SRCS)
|
||||
lint: $(LINT_REPORT)
|
||||
|
||||
$(LINT_REPORT): $(NONGEN_CXX_SRCS)
|
||||
@ mkdir -p $(BUILD_DIR)
|
||||
@ (python ./scripts/cpp_lint.py $(NONGEN_CXX_SRCS) > $(LINT_REPORT) 2>&1 \
|
||||
&& (rm -f $(FAILED_LINT_REPORT); echo "No lint errors!")) || ( \
|
||||
mv $(LINT_REPORT) $(FAILED_LINT_REPORT); \
|
||||
grep -v "^Done processing " $(FAILED_LINT_REPORT); \
|
||||
echo "Found 1 or more lint errors; see log at $(FAILED_LINT_REPORT)"; \
|
||||
exit 1)
|
||||
|
||||
test: init $(TEST_BINS)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#define MEX_ARGS int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs
|
||||
|
||||
namespace caffe {
|
||||
using namespace caffe; // NOLINT(build/namespaces)
|
||||
|
||||
// The pointer to the internal caffe::Net instance
|
||||
static shared_ptr<Net<float> > net_;
|
||||
|
@ -189,5 +189,3 @@ void mexFunction(MEX_ARGS) {
|
|||
mxFree(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace caffe
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#define PyArray_SetBaseObject(arr, x) (PyArray_BASE(arr) = (x))
|
||||
#endif
|
||||
|
||||
|
||||
using namespace caffe; // NOLINT(build/namespaces)
|
||||
using boost::python::extract;
|
||||
using boost::python::len;
|
||||
using boost::python::list;
|
||||
|
@ -27,7 +29,6 @@ using boost::python::object;
|
|||
using boost::python::handle;
|
||||
using boost::python::vector_indexing_suite;
|
||||
|
||||
namespace caffe {
|
||||
|
||||
// wrap shared_ptr<Blob<float> > in a class that we construct in C++ and pass
|
||||
// to Python
|
||||
|
@ -278,5 +279,3 @@ BOOST_PYTHON_MODULE(pycaffe) {
|
|||
|
||||
import_array();
|
||||
}
|
||||
|
||||
} // namespace caffe
|
||||
|
|
|
@ -54,7 +54,7 @@ import unicodedata
|
|||
|
||||
|
||||
_USAGE = """
|
||||
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
|
||||
Syntax: cpp_lint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
|
||||
[--counting=total|toplevel|detailed] [--root=subdir]
|
||||
[--linelength=digits]
|
||||
<file> [file] ...
|
||||
|
|
Загрузка…
Ссылка в новой задаче