Skip to content

Commit 583d60b

Browse files
committed
Remove cppcheck and vera++ from prerequisites
Rely on platform-provided versions. Thus, no need to download and build them, neither to wrap them with shell scripts. CMake and precommit updated to call the new tools. PS: On my Ubuntu 14.04.3, cppcheck has version 1.61, while prereq version was 1.69. The older version reports and fails on a strange style issue in ecma/builtin-objects/ecma-builtin-helpers.cpp, for which the only solution found was to suppress cppcheck errors with `variableScope` id. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent cadc81d commit 583d60b

File tree

6 files changed

+4
-177
lines changed

6 files changed

+4
-177
lines changed

build/static-checkers/add_cppcheck_for_target.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Cppcheck launcher
16-
set(CMAKE_CPPCHECK ${CMAKE_SOURCE_DIR}/tools/cppcheck/cppcheck.sh)
16+
set(CMAKE_CPPCHECK cppcheck)
1717

1818
# Definition of cppcheck targets
1919
add_custom_target(cppcheck)
@@ -54,6 +54,7 @@
5454
add_custom_target(cppcheck.${TARGET_NAME}
5555
COMMAND ${CMAKE_CPPCHECK} -j8 --error-exitcode=1 --language=c++ --std=c++11
5656
--enable=warning,style,performance,portability,information
57+
--exitcode-suppressions=${CMAKE_SOURCE_DIR}/tools/cppcheck/suppressions-list
5758
${CPPCHECK_DEFINES_LIST} ${CPPCHECK_SOURCES_LIST} ${CPPCHECK_INCLUDES_LIST}
5859
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
5960
else()

tools/cppcheck/cppcheck.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

tools/cppcheck/suppressions-list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
operatorEqVarError
22
noConstructor
33
duplicateExpression
4+
variableScope

tools/precommit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ VERA_DIRECTORIES_EXCLUDE_LIST="-path ./third-party -o -path tests -o -path ./tar
4040
VERA_CONFIGURATION_PATH="./tools/vera++"
4141

4242
SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.cpp" -or -name "*.h"`
43-
./tools/vera++/vera.sh -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
43+
vera++ -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
4444
STATUS_CODE=$?
4545

4646
if [ $STATUS_CODE -ne 0 ]

tools/prerequisites.sh

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -99,114 +99,6 @@ function setup_from_zip() {
9999
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
100100
}
101101

102-
function setup_cppcheck() {
103-
NAME="$1"
104-
shift
105-
106-
DEST=$(pwd)/"$1"
107-
shift
108-
109-
URL="$1"
110-
shift
111-
112-
CHECKSUM="$1"
113-
shift
114-
115-
FAIL_MSG="Failed to setup '$NAME' prerequisite"
116-
117-
if [ "$CLEAN_MODE" == "no" ]
118-
then
119-
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
120-
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
121-
122-
echo "Setting up $NAME prerequisite"
123-
fi
124-
125-
if [ -e "$DEST" ]
126-
then
127-
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
128-
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
129-
fi
130-
131-
if [ "$CLEAN_MODE" == "yes" ]
132-
then
133-
return 0
134-
fi
135-
136-
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.bz2" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
137-
138-
echo "$CHECKSUM $TMP_DIR/$NAME.tar.bz2" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
139-
140-
tar xjvf "$TMP_DIR/$NAME.tar.bz2" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
141-
142-
(
143-
cd "$TMP_DIR/$NAME" || exit 1
144-
make -j HAVE_RULES=yes CFGDIR="$DEST/cfg" || exit 1
145-
) || fail_msg "$FAIL_MSG. Failed to build cppcheck."
146-
147-
mkdir "$DEST" || fail_msg "$FAIL_MSG. Failed to create '$DEST' directory."
148-
mkdir "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to create '$DEST/cfg' directory."
149-
150-
cp "$TMP_DIR/$NAME/cppcheck" "$DEST" || fail_msg "$FAIL_MSG. Failed to copy cppcheck to '$DEST' directory."
151-
cp "$TMP_DIR/$NAME/cfg/std.cfg" "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to copy cfg/std.cfg to '$DEST/cfg' directory."
152-
153-
remove_gitignore_files_at "$DEST"
154-
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
155-
}
156-
157-
function setup_vera() {
158-
NAME="$1"
159-
shift
160-
161-
DEST=$(pwd)/"$1"
162-
shift
163-
164-
URL="$1"
165-
shift
166-
167-
CHECKSUM="$1"
168-
shift
169-
170-
FAIL_MSG="Failed to setup '$NAME' prerequisite"
171-
172-
if [ "$CLEAN_MODE" == "no" ]
173-
then
174-
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
175-
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
176-
177-
echo "Setting up $NAME prerequisite"
178-
fi
179-
180-
if [ -e "$DEST" ]
181-
then
182-
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
183-
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
184-
fi
185-
186-
if [ "$CLEAN_MODE" == "yes" ]
187-
then
188-
return 0
189-
fi
190-
191-
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.gz" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
192-
193-
echo "$CHECKSUM $TMP_DIR/$NAME.tar.gz" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
194-
195-
tar xzvf "$TMP_DIR/$NAME.tar.gz" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
196-
197-
(
198-
cd "$TMP_DIR/$NAME" || exit 1
199-
mkdir build || exit 1
200-
cd build || exit 1
201-
cmake .. -DCMAKE_INSTALL_PREFIX="$DEST" || exit 1
202-
make -j || exit 1
203-
make install || exit 1
204-
) || fail_msg "$FAIL_MSG. Failed to build vera++ 1.2.1."
205-
206-
remove_gitignore_files_at "$DEST"
207-
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
208-
}
209-
210102
HOST_OS=`uname -s`
211103

212104
if [ "$HOST_OS" == "Darwin" ]
@@ -238,16 +130,6 @@ setup_from_zip "stm32f4" \
238130
"8e67f7b930c6c02bd7f89a266c8d1cae3b530510b7979fbfc0ee0d57e7f88b81" \
239131
"STM32F4-Discovery_FW_V1.1.0/*"
240132

241-
setup_cppcheck "cppcheck-1.69" \
242-
"./third-party/cppcheck" \
243-
"http://downloads.sourceforge.net/project/cppcheck/cppcheck/1.69/cppcheck-1.69.tar.bz2" \
244-
"4bd5c8031258ef29764a4c92666384238a625beecbb2aceeb7065ec388c7532e"
245-
246-
setup_vera "vera++-1.2.1" \
247-
"./third-party/vera++" \
248-
"https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1.tar.gz" \
249-
"99b123c8f6d0f4fe9ee90397c461179066a36ed0d598d95e015baf2d3b56956b"
250-
251133
if [ "$CLEAN_MODE" == "no" ]
252134
then
253135
mv $TMP_DIR/.prerequisites $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to write '$PREREQUISITES_INSTALLED_LIST_FILE'"

tools/vera++/vera.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)