From 70d76efc984d158377eb8f369d36c88a0a94d395 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 17 Sep 2014 15:02:16 +0400 Subject: [PATCH] Adding cppcheck utility to repository. --- Makefile.mk | 4 ++-- tools/cppcheck.sh | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 tools/cppcheck.sh diff --git a/Makefile.mk b/Makefile.mk index 47e9b6b54..e7886e09b 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -394,7 +394,7 @@ all: clean $(JERRY_TARGETS) $(JERRY_TARGETS): @rm -rf $(TARGET_DIR) @mkdir -p $(TARGET_DIR) - @cppcheck -j8 $(DEFINES_JERRY) $(SOURCES_JERRY_C) $(MAIN_MODULE_SRC) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \ + @./tools/cppcheck.sh -j8 $(DEFINES_JERRY) $(SOURCES_JERRY_C) $(MAIN_MODULE_SRC) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \ --error-exitcode=1 --std=c99 --enable=all 1>/dev/null @vera++ -r ./tools/vera++ -p jerry $(SOURCES_JERRY_C) $(MAIN_MODULE_SRC) $(SOURCES_JERRY_H) -e --no-duplicate 1>$(TARGET_DIR)/vera.log @mkdir -p $(TARGET_DIR)/obj @@ -427,7 +427,7 @@ $(TESTS_TARGET): @rm -rf $(TARGET_DIR) @mkdir -p $(TARGET_DIR) @mkdir -p $(TARGET_DIR)/obj - @cppcheck -j8 $(DEFINES_JERRY) `find $(UNITTESTS_SRC_DIR) -name *.[c]` $(SOURCES_JERRY_C) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \ + @./tools/cppcheck.sh -j8 $(DEFINES_JERRY) `find $(UNITTESTS_SRC_DIR) -name *.[c]` $(SOURCES_JERRY_C) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \ --error-exitcode=1 --std=c99 --enable=all 1>/dev/null @source_index=0; \ for jerry_src in $(SOURCES_JERRY); \ diff --git a/tools/cppcheck.sh b/tools/cppcheck.sh new file mode 100755 index 000000000..61fbdb6e4 --- /dev/null +++ b/tools/cppcheck.sh @@ -0,0 +1,25 @@ +# Copyright 2014 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash + +if [ ! -x ./third-party/tools/cppcheck/$(uname -m)/cppcheck ] +then + exit 1; +fi + +./third-party/tools/cppcheck/$(uname -m)/cppcheck "$@" +status_code=$? + +exit $status_code