linux/tools/perf/tests
Jiri Olsa b9229b2c89 perf tools: Fix snprint warnings for gcc 8
commit 77f18153c0 upstream.

With gcc 8 we get new set of snprintf() warnings that breaks the
compilation, one example:

  tests/mem.c: In function ‘check’:
  tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
        up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
    snprintf(failure, sizeof failure, "unexpected %s", out);

The gcc docs says:

 To avoid the warning either use a bigger buffer or handle the
 function's return value which indicates whether or not its output
 has been truncated.

Given that all these warnings are harmless, because the code either
properly fails due to uncomplete file path or we don't care for
truncated output at all, I'm changing all those snprintf() calls to
scnprintf(), which actually 'checks' for the snprint return value so the
gcc stays silent.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Link: http://lkml.kernel.org/r/20180319082902.4518-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[bwh: Backported to 3.16: Drop changes in tools/perf/tests/mem.c]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-11-20 18:06:05 +00:00
..
attr perf tests attr: Fix no-delay test 2017-11-26 13:50:13 +00:00
attr.c perf tools: Fix snprint warnings for gcc 8 2018-11-20 18:06:05 +00:00
attr.py perf tests: Make attr script test event cpu 2013-03-15 13:06:00 -03:00
bp_signal.c perf tests: Fix compile errors in bp_signal files 2013-05-28 16:23:57 +03:00
bp_signal_overflow.c perf tests: Fix compile errors in bp_signal files 2013-05-28 16:23:57 +03:00
builtin-test.c perf tests: Add test for closing dso objects on EMFILE error 2014-06-12 16:53:23 +02:00
code-reading.c perf tools: Use tid for finding thread 2014-05-12 11:09:50 +02:00
dso-data.c perf tests: Add test for closing dso objects on EMFILE error 2014-06-12 16:53:23 +02:00
dwarf-unwind.c Revert "perf: Disable PERF_RECORD_MMAP2 support" 2014-06-09 13:34:46 +02:00
evsel-roundtrip-name.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
evsel-tp-sched.c perf tools: Remove usage of trace_sched_wakeup(.success) 2014-05-12 21:13:44 +02:00
hists_common.c perf tests: Add a test case for cumulating callchains 2014-06-01 14:35:11 +02:00
hists_common.h perf tests: Define and use symbolic names for fake symbols 2014-06-01 14:35:11 +02:00
hists_cumulate.c perf tests: Add a test case for cumulating callchains 2014-06-01 14:35:11 +02:00
hists_filter.c perf tests: Define and use symbolic names for fake symbols 2014-06-01 14:35:11 +02:00
hists_link.c perf tests: Define and use symbolic names for fake symbols 2014-06-01 14:35:11 +02:00
hists_output.c perf tests: Define and use symbolic names for fake symbols 2014-06-01 14:35:11 +02:00
keep-tracking.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
make perf tests: Show the inner make output when an error happens 2014-06-09 12:14:22 -03:00
mmap-basic.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
mmap-thread-lookup.c perf tests: Add thread maps lookup automated tests 2014-04-28 13:42:52 +02:00
open-syscall-all-cpus.c perf evsel: Remove idx parm from constructor 2013-11-11 15:56:39 -03:00
open-syscall-tp-fields.c perf record: Rename --no-delay to --no-buffering 2014-01-14 17:57:04 -03:00
open-syscall.c perf evsel: Remove idx parm from constructor 2013-11-11 15:56:39 -03:00
parse-events.c perf tests: Avoid possible truncation with dirent->d_name + snprintf 2017-06-05 21:17:06 +01:00
parse-no-sample-id-all.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
perf-record.c perf record: Rename --no-delay to --no-buffering 2014-01-14 17:57:04 -03:00
perf-targz-src-pkg perf tools: Add test for building detached source tarballs 2014-01-13 10:06:26 -03:00
perf-time-to-tsc.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
pmu.c perf tools: Fix snprint warnings for gcc 8 2018-11-20 18:06:05 +00:00
python-use.c perf tests: Check python path on attr and binding test 2013-01-24 16:40:10 -03:00
rdpmc.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
sample-parsing.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
sw-clock.c perf evlist: Auto unmap on destructor 2014-01-13 10:06:22 -03:00
task-exit.c perf evlist: Auto unmap on destructor 2014-01-13 10:06:22 -03:00
tests.h perf tests: Add test for closing dso objects on EMFILE error 2014-06-12 16:53:23 +02:00
thread-mg-share.c perf tests: Add map groups sharing with thread object test 2014-04-28 13:43:40 +02:00
vmlinux-kallsyms.c perf tests: No need to set up ref_reloc_sym 2014-01-31 17:21:52 -03:00