Lines Matching +full:build +full:- +full:in
2 # SPDX-License-Identifier: GPL-2.0-only
3 set -e
5 # Argument 1: Source file to build.
6 IN="$1"
9 FILE="${IN##*/}"
11 FUNC="${FILE#*-}"
12 FUNC="${FUNC%%-*}"
14 # Extract the symbol to test for in build/symbol test below.
15 WANT="__${FILE%%-*}"
17 # Argument 2: Where to write the build log.
30 rm -f "$TMP"
34 # Function names in warnings are wrapped in backticks under UTF-8 locales.
39 # Attempt to build a source that is expected to fail with a specific warning.
40 if "$@" -Werror -c "$IN" -o "$OUT".o 2> "$TMP" ; then
41 # If the build succeeds, either the test has failed or the
42 # warning may only happen at link time (Clang). In that case,
43 # make sure the expected symbol is unresolved in the symbol list.
45 if ! $NM -A "$OUT".o | grep -m1 "\bU ${WANT}$" >>"$TMP" ; then
46 status="warning: unsafe ${FUNC}() usage lacked '$WANT' symbol in $IN"
49 # If the build failed, check for the warning in the stderr.
51 …-string.h:316:25: error: call to '__write_overflow_field' declared with attribute warning: detecte…
53 …-string.h:316:4: error: call to __write_overflow_field declared with 'warning' attribute: detected…
54 if ! grep -Eq -m1 "error: call to .?\b${WANT}\b.?" "$TMP" ; then
55 status="warning: unsafe ${FUNC}() usage lacked '$WANT' warning in $IN"
59 if [ -n "$status" ]; then
64 echo "ok: unsafe ${FUNC}() usage correctly detected with '$WANT' in $IN" >"$OUT"