mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
libdiagnostics: add a "sarif-replay" command-line tool [PR96032]
This patch adds a new "sarif-replay" command-line tool for viewing .sarif files. It uses libdiagnostics to "replay" any diagnostics found in the .sarif files in text form as if they were GCC diagnostics. contrib/ChangeLog: PR other/96032 * regenerate-sarif-spec-index.py: New file. gcc/ChangeLog: PR other/96032 * Makefile.in (lang_checks): If libdiagnostics is enabled, add check-sarif-replay. (SARIF_REPLAY_OBJS): New. (ALL_HOST_OBJS): If libdiagnostics is enabled, add $(SARIF_REPLAY_OBJS). (sarif-replay): New. (install-libdiagnostics): Add sarif-replay to deps, and install it. * configure: Regenerate. * configure.ac (check_languages): If libdiagnostics is enabled, add check-sarif-replay. (LIBDIAGNOSTICS): If libdiagnostics is enabled, add sarif-replay. * doc/install.texi (--enable-libdiagnostics): Note that it also enables sarif-replay. * libsarifreplay.cc: New file. * libsarifreplay.h: New file. * sarif-replay.cc: New file. * sarif-spec-urls.def: New file. gcc/testsuite/ChangeLog: PR other/96032 * lib/gcc-dg.exp (gcc-dg-test-1): Add "replay-sarif". * lib/sarif-replay-dg.exp: New file. * lib/sarif-replay.exp: New file. * sarif-replay.dg/2.1.0-invalid/3.1-not-an-object.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.11.11-malformed-placeholder.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.11.11-missing-arguments-for-placeholders.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.11.11-not-enough-arguments-for-placeholders.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.13.2-no-version.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.13.2-version-not-a-string.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.13.4-bad-runs.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.13.4-no-runs.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.13.4-non-object-in-runs.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.27.10-bad-level.sarif: New test. * sarif-replay.dg/2.1.0-unhandled/3.27.10-none-level.sarif: New test. * sarif-replay.dg/2.1.0-valid/error-with-note.sarif: New test. * sarif-replay.dg/2.1.0-valid/escaped-braces.sarif: New test. * sarif-replay.dg/2.1.0-valid/null-runs.sarif: New test. * sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: New test. * sarif-replay.dg/2.1.0-valid/spec-example-1.sarif: New test. * sarif-replay.dg/2.1.0-valid/spec-example-2.sarif: New test. * sarif-replay.dg/2.1.0-valid/spec-example-3.sarif: New test. * sarif-replay.dg/2.1.0-valid/spec-example-4.sarif: New test. * sarif-replay.dg/2.1.0-valid/tutorial-example.sarif: New test. * sarif-replay.dg/dg.exp: New script. * sarif-replay.dg/malformed-json/array-missing-comma.sarif: New test. * sarif-replay.dg/malformed-json/array-with-trailing-comma.sarif: New test. * sarif-replay.dg/malformed-json/bad-token.sarif: New test. * sarif-replay.dg/malformed-json/object-missing-comma.sarif: New test. * sarif-replay.dg/malformed-json/object-with-trailing-comma.sarif: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
parent
66e6e4f131
commit
ea1506adbe
60
contrib/regenerate-sarif-spec-index.py
Normal file
60
contrib/regenerate-sarif-spec-index.py
Normal file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GCC.
|
||||
#
|
||||
# GCC is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free
|
||||
# Software Foundation; either version 3, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Unfortunately the SARIF 2.1.0 spec doesn't have memorable anchors
|
||||
# for its subsections
|
||||
# (filed as https://github.com/oasis-tcs/sarif-spec/issues/533)
|
||||
#
|
||||
# In the meantime, use this script to generate a table mapping subsections
|
||||
# to anchors.
|
||||
|
||||
from pprint import pprint
|
||||
import re
|
||||
|
||||
spec_url = 'https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html'
|
||||
filename_in = 'sarif-v2.1.0-errata01-os-complete.html'
|
||||
|
||||
d = {}
|
||||
with open(filename_in, encoding='windows-1252') as infile:
|
||||
for line in infile:
|
||||
m = re.match(r'<p class=MsoToc[0-9]+><a href="#(.*)">(.*)<span.*\n', line)
|
||||
if m:
|
||||
#print('MATCH')
|
||||
#print(repr(line))
|
||||
#print(m.groups())
|
||||
m2 = re.match(r'([0-9.]+) .*', m.group(2))
|
||||
if m2:
|
||||
#print(m2.groups())
|
||||
d[m2.group(1)] = m.group(1)
|
||||
|
||||
filename_out = '../gcc/sarif-spec-urls.def'
|
||||
with open(filename_out, 'w') as outfile:
|
||||
outfile.write('/* Generated by regenerate-sarif-spec-index.py. */\n\n')
|
||||
|
||||
outfile.write(f'static const char * const sarif_spec_base_url\n = "{spec_url}";\n\n')
|
||||
|
||||
outfile.write('static const struct ref_anchor\n'
|
||||
'{\n'
|
||||
' const char *m_ref;\n'
|
||||
' const char *m_anchor;\n'
|
||||
'} sarif_spec_anchor_arr[] = {\n');
|
||||
for ref, anchor in d.items():
|
||||
outfile.write(f' {{ "{ref}", "{anchor}" }},\n')
|
||||
outfile.write('};')
|
@ -621,7 +621,7 @@ xm_defines=@xm_defines@
|
||||
lang_checks=
|
||||
lang_checks_parallelized=
|
||||
ifeq (@enable_libdiagnostics@,yes)
|
||||
lang_checks += check-libdiagnostics
|
||||
lang_checks += check-libdiagnostics check-sarif-replay
|
||||
endif
|
||||
lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt $(srcdir)/params.opt $(srcdir)/analyzer/analyzer.opt
|
||||
lang_specs_files=@lang_specs_files@
|
||||
@ -1297,6 +1297,8 @@ RUST_TARGET_OBJS=@rust_target_objs@
|
||||
# Object files for gcc many-languages driver.
|
||||
GCC_OBJS = gcc.o gcc-main.o ggc-none.o gcc-urlifier.o options-urls.o
|
||||
|
||||
SARIF_REPLAY_OBJS = sarif-replay.o libsarifreplay.o
|
||||
|
||||
c-family-warn = $(STRICT_WARN)
|
||||
|
||||
# Language-specific object files shared by all C-family front ends.
|
||||
@ -1886,7 +1888,7 @@ endif
|
||||
ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
|
||||
|
||||
ifeq (@enable_libdiagnostics@,yes)
|
||||
ALL_HOST_OBJS += $(libdiagnostics_OBJS)
|
||||
ALL_HOST_OBJS += $(libdiagnostics_OBJS) $(SARIF_REPLAY_OBJS)
|
||||
endif
|
||||
|
||||
BACKEND = libbackend.a main.o libcommon-target.a libcommon.a \
|
||||
@ -2407,6 +2409,12 @@ $(LIBDIAGNOSTICS_LINKER_NAME_SYMLINK): $(LIBDIAGNOSTICS_SONAME_SYMLINK)
|
||||
ln -sf $(LIBDIAGNOSTICS_SONAME_SYMLINK) $(LIBDIAGNOSTICS_LINKER_NAME_SYMLINK)
|
||||
endif
|
||||
|
||||
# sarif-replay: a command-line tool that uses libdiagnostics to
|
||||
# replay SARIF files
|
||||
sarif-replay: $(SARIF_REPLAY_OBJS) $(LIBDIAGNOSTICS_FILENAME)
|
||||
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(SARIF_REPLAY_OBJS) $(LIBDIAGNOSTICS_FILENAME) $(LIBS)
|
||||
|
||||
# Dump a specs file to make -B./ read these specs over installed ones.
|
||||
$(SPECS): xgcc$(exeext)
|
||||
$(GCC_FOR_TARGET) -dumpspecs > tmp-specs
|
||||
@ -4167,7 +4175,9 @@ libdiagnostics.install-common: installdirs libdiagnostics.install-headers
|
||||
endif
|
||||
endif
|
||||
|
||||
install-libdiagnostics: libdiagnostics.install-common
|
||||
install-libdiagnostics: libdiagnostics.install-common sarif-replay
|
||||
-rm -f $(DESTDIR)$(bindir)/sarif-replay
|
||||
-$(INSTALL_PROGRAM) sarif-replay $(DESTDIR)$(bindir)/sarif-replay
|
||||
|
||||
# Install the info files.
|
||||
# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
|
||||
|
4
gcc/configure
vendored
4
gcc/configure
vendored
@ -33843,7 +33843,7 @@ do
|
||||
check_languages="$check_languages check-$language"
|
||||
done
|
||||
if test x$enable_libdiagnostics = xyes; then
|
||||
check_languages="$check_languages check-libdiagnostics"
|
||||
check_languages="$check_languages check-libdiagnostics check-sarif-replay"
|
||||
fi
|
||||
|
||||
selftest_languages=
|
||||
@ -34291,7 +34291,7 @@ fi
|
||||
|
||||
|
||||
if test "$enable_libdiagnostics" = "yes"; then
|
||||
LIBDIAGNOSTICS='libdiagnostics'
|
||||
LIBDIAGNOSTICS='libdiagnostics sarif-replay'
|
||||
else
|
||||
LIBDIAGNOSTICS=''
|
||||
fi
|
||||
|
@ -7381,7 +7381,7 @@ do
|
||||
check_languages="$check_languages check-$language"
|
||||
done
|
||||
if test x$enable_libdiagnostics = xyes; then
|
||||
check_languages="$check_languages check-libdiagnostics"
|
||||
check_languages="$check_languages check-libdiagnostics check-sarif-replay"
|
||||
fi
|
||||
|
||||
selftest_languages=
|
||||
@ -7621,7 +7621,7 @@ AC_ARG_ENABLE(libdiagnostics,
|
||||
AC_SUBST(enable_libdiagnostics)
|
||||
|
||||
if test "$enable_libdiagnostics" = "yes"; then
|
||||
LIBDIAGNOSTICS='libdiagnostics'
|
||||
LIBDIAGNOSTICS='libdiagnostics sarif-replay'
|
||||
else
|
||||
LIBDIAGNOSTICS=''
|
||||
fi
|
||||
|
@ -1238,6 +1238,12 @@ GCC's diagnostics capabilities via a C API, and a C++ wrapper API adding
|
||||
|
||||
This option requires @option{--enable-host-shared} on non-Windows hosts.
|
||||
|
||||
This option also enables @code{sarif-replay}, a command-line tool for
|
||||
viewing @uref{https://sarif.info/,,SARIF files}. @code{sarif-replay} takes
|
||||
one or more @code{.sarif} files as input and attempts to replay any
|
||||
diagnostics within them to stderr (via @code{libdiagnostics}) in the style
|
||||
of GCC's diagnostics.
|
||||
|
||||
@item --disable-gcov
|
||||
Specify that the run-time library used for coverage analysis
|
||||
and associated host tools should not be built.
|
||||
|
1747
gcc/libsarifreplay.cc
Normal file
1747
gcc/libsarifreplay.cc
Normal file
File diff suppressed because it is too large
Load Diff
59
gcc/libsarifreplay.h
Normal file
59
gcc/libsarifreplay.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* A pure C API for replaying SARIF as diagnostics.
|
||||
Copyright (C) 2023-2024 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef LIBSARIFREPLAY_H
|
||||
#define LIBSARIFREPLAY_H
|
||||
|
||||
#include "libdiagnostics.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct replay_options
|
||||
{
|
||||
bool m_echo_file;
|
||||
bool m_json_comments;
|
||||
bool m_verbose;
|
||||
enum diagnostic_colorize m_diagnostics_colorize;
|
||||
};
|
||||
|
||||
/* Attempt to load a .sarif file from SARIF_FILE, and
|
||||
replay the diagnostics to OUTPUT_MANAGER.
|
||||
Report any problems to CONTROL_MANAGER (such as
|
||||
file-not-found, malformed .sarif, etc).
|
||||
If ALLOW_JSON_COMMENTS is true, then allow C/C++ style comments
|
||||
in the file.
|
||||
If ECHO_FILE, then dump the filename and contents to stderr. */
|
||||
|
||||
extern int
|
||||
sarif_replay_path (const char *sarif_file,
|
||||
diagnostic_manager *output_manager,
|
||||
diagnostic_manager *control_manager,
|
||||
const replay_options *options)
|
||||
LIBDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (1)
|
||||
LIBDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (2)
|
||||
LIBDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (3)
|
||||
LIBDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (4);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LIBSARIFREPLAY_H */
|
239
gcc/sarif-replay.cc
Normal file
239
gcc/sarif-replay.cc
Normal file
@ -0,0 +1,239 @@
|
||||
/* A program for re-emitting diagnostics saved in SARIF form.
|
||||
Copyright (C) 2022-2024 Free Software Foundation, Inc.
|
||||
Contributed by David Malcolm <dmalcolm@redhat.com>.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
#define INCLUDE_VECTOR
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "version.h"
|
||||
#include "intl.h"
|
||||
#include "libdiagnostics++.h"
|
||||
#include "libsarifreplay.h"
|
||||
|
||||
static const char *progname;
|
||||
|
||||
static void
|
||||
set_defaults (replay_options &replay_opts)
|
||||
{
|
||||
/* Defaults. */
|
||||
replay_opts.m_echo_file = false;
|
||||
replay_opts.m_json_comments = false;
|
||||
replay_opts.m_verbose = false;
|
||||
replay_opts.m_diagnostics_colorize = DIAGNOSTIC_COLORIZE_IF_TTY;
|
||||
}
|
||||
|
||||
struct options
|
||||
{
|
||||
options ()
|
||||
{
|
||||
set_defaults (m_replay_opts);
|
||||
}
|
||||
|
||||
replay_options m_replay_opts;
|
||||
std::vector<const char *> m_sarif_filenames;
|
||||
};
|
||||
|
||||
static void
|
||||
print_version ()
|
||||
{
|
||||
printf (_("%s %s%s\n"), progname, pkgversion_string,
|
||||
version_string);
|
||||
printf ("Copyright %s 2024 Free Software Foundation, Inc.\n",
|
||||
_("(C)"));
|
||||
fputs (_("This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"),
|
||||
stdout);
|
||||
}
|
||||
|
||||
static const char *const usage_msg = (
|
||||
"sarif-replay [OPTIONS] FILE+\n"
|
||||
"\n"
|
||||
" \"Replay\" results from one or more .sarif files as if they were\n"
|
||||
" GCC diagnostics\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
"\n"
|
||||
" -fdiagnostics-color={never|always|auto}\n"
|
||||
" Control colorization of diagnostics. Default: auto.\n"
|
||||
"\n"
|
||||
" -fjson-comments\n"
|
||||
" Support C and C++ style comments in .sarif JSON files\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
" Print notes about each .sarif file before and after replaying it.\n"
|
||||
"\n"
|
||||
" --echo-file\n"
|
||||
" Print the filename and file contents to stderr before replaying it.\n"
|
||||
"\n"
|
||||
" -v, --version\n"
|
||||
" Print version and exit.\n"
|
||||
"\n"
|
||||
" --usage\n"
|
||||
" Print this message and exit.\n"
|
||||
"\n");
|
||||
|
||||
static void
|
||||
print_usage ()
|
||||
{
|
||||
fprintf (stderr, usage_msg);
|
||||
}
|
||||
|
||||
static bool
|
||||
parse_options (int argc, char **argv,
|
||||
options &opts,
|
||||
libdiagnostics::text_sink control_text_sink)
|
||||
{
|
||||
libdiagnostics::manager options_mgr;
|
||||
options_mgr.set_tool_name ("sarif-replay");
|
||||
options_mgr.add_text_sink (stderr, DIAGNOSTIC_COLORIZE_NO/*IF_TTY*/);
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
const char *option = argv[i];
|
||||
bool handled = false;
|
||||
if (strcmp (option, "-fjson-comments") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_json_comments = true;
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "--verbose") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_verbose = true;
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "--usage") == 0)
|
||||
{
|
||||
print_usage ();
|
||||
exit (0);
|
||||
}
|
||||
else if (strcmp (option, "--echo-file") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_echo_file = true;
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "-fdiagnostics-color=never") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_diagnostics_colorize = DIAGNOSTIC_COLORIZE_NO;
|
||||
control_text_sink.set_colorize
|
||||
(opts.m_replay_opts.m_diagnostics_colorize);
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "-fdiagnostics-color=always") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_diagnostics_colorize = DIAGNOSTIC_COLORIZE_YES;
|
||||
control_text_sink.set_colorize
|
||||
(opts.m_replay_opts.m_diagnostics_colorize);
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "-fdiagnostics-color=auto") == 0)
|
||||
{
|
||||
opts.m_replay_opts.m_diagnostics_colorize
|
||||
= DIAGNOSTIC_COLORIZE_IF_TTY;
|
||||
control_text_sink.set_colorize
|
||||
(opts.m_replay_opts.m_diagnostics_colorize);
|
||||
handled = true;
|
||||
}
|
||||
else if (strcmp (option, "-v") == 0
|
||||
|| strcmp (option, "--version") == 0)
|
||||
{
|
||||
print_version ();
|
||||
exit (0);
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
if (option[0] == '-')
|
||||
{
|
||||
auto err = options_mgr.begin_diagnostic (DIAGNOSTIC_LEVEL_ERROR);
|
||||
err.finish ("unrecognized option: %qs", option);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
opts.m_sarif_filenames.push_back (option);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.m_sarif_filenames.size () == 0)
|
||||
{
|
||||
auto err = options_mgr.begin_diagnostic (DIAGNOSTIC_LEVEL_ERROR);
|
||||
err.finish ("need at least one .sarif file to dump");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_progname (const char *argv0)
|
||||
{
|
||||
const char *p = argv0 + strlen (argv0);
|
||||
while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
|
||||
--p;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Entrypoint to sarif-replay command-line tool. */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
progname = get_progname (argv[0]);
|
||||
xmalloc_set_program_name (progname);
|
||||
|
||||
libdiagnostics::manager control_mgr;
|
||||
|
||||
control_mgr.set_tool_name (progname);
|
||||
|
||||
libdiagnostics::text_sink control_text_sink
|
||||
= control_mgr.add_text_sink (stderr, DIAGNOSTIC_COLORIZE_IF_TTY);
|
||||
|
||||
options opts;
|
||||
if (!parse_options (argc, argv, opts, control_text_sink))
|
||||
{
|
||||
print_usage ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int failures = 0;
|
||||
for (auto filename : opts.m_sarif_filenames)
|
||||
{
|
||||
if (opts.m_replay_opts.m_verbose)
|
||||
{
|
||||
auto note = control_mgr.begin_diagnostic (DIAGNOSTIC_LEVEL_NOTE);
|
||||
note.finish ("about to replay %qs...", filename);
|
||||
}
|
||||
libdiagnostics::manager playback_mgr;
|
||||
playback_mgr.add_text_sink (stderr,
|
||||
opts.m_replay_opts.m_diagnostics_colorize);
|
||||
|
||||
int result = sarif_replay_path (filename,
|
||||
playback_mgr.m_inner,
|
||||
control_mgr.m_inner,
|
||||
&opts.m_replay_opts);
|
||||
if (result)
|
||||
++failures;
|
||||
|
||||
if (opts.m_replay_opts.m_verbose)
|
||||
{
|
||||
auto note = control_mgr.begin_diagnostic (DIAGNOSTIC_LEVEL_NOTE);
|
||||
note.finish ("...finished replaying %qs", filename);
|
||||
}
|
||||
}
|
||||
return failures;
|
||||
}
|
496
gcc/sarif-spec-urls.def
Normal file
496
gcc/sarif-spec-urls.def
Normal file
@ -0,0 +1,496 @@
|
||||
/* Generated by regenerate-sarif-spec-index.py. */
|
||||
|
||||
static const char * const sarif_spec_base_url
|
||||
= "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html";
|
||||
|
||||
static const struct ref_anchor
|
||||
{
|
||||
const char *m_ref;
|
||||
const char *m_anchor;
|
||||
} sarif_spec_anchor_arr[] = {
|
||||
{ "1.1", "_Toc141790658" },
|
||||
{ "1.2", "_Toc141790659" },
|
||||
{ "1.3", "_Toc141790660" },
|
||||
{ "1.4", "_Toc141790661" },
|
||||
{ "1.5", "_Toc141790662" },
|
||||
{ "2.1", "_Toc141790664" },
|
||||
{ "2.2", "_Toc141790665" },
|
||||
{ "2.3", "_Toc141790666" },
|
||||
{ "2.4", "_Toc141790667" },
|
||||
{ "2.5", "_Toc141790668" },
|
||||
{ "3.1", "_Toc141790670" },
|
||||
{ "3.2", "_Toc141790671" },
|
||||
{ "3.3", "_Toc141790672" },
|
||||
{ "3.3.1", "_Toc141790673" },
|
||||
{ "3.3.2", "_Toc141790674" },
|
||||
{ "3.3.3", "_Toc141790675" },
|
||||
{ "3.3.4", "_Toc141790676" },
|
||||
{ "3.4", "_Toc141790677" },
|
||||
{ "3.4.1", "_Toc141790678" },
|
||||
{ "3.4.2", "_Toc141790679" },
|
||||
{ "3.4.3", "_Toc141790680" },
|
||||
{ "3.4.4", "_Toc141790681" },
|
||||
{ "3.4.5", "_Toc141790682" },
|
||||
{ "3.4.6", "_Toc141790683" },
|
||||
{ "3.5", "_Toc141790685" },
|
||||
{ "3.5.1", "_Toc141790686" },
|
||||
{ "3.5.2", "_Toc141790687" },
|
||||
{ "3.5.3", "_Toc141790688" },
|
||||
{ "3.5.4", "_Toc141790689" },
|
||||
{ "3.5.4.1", "_Toc141790690" },
|
||||
{ "3.6", "_Toc141790692" },
|
||||
{ "3.7", "_Toc141790693" },
|
||||
{ "3.7.1", "_Toc141790694" },
|
||||
{ "3.7.2", "_Toc141790695" },
|
||||
{ "3.7.4", "_Toc141790697" },
|
||||
{ "3.8", "_Toc141790698" },
|
||||
{ "3.8.1", "_Toc141790699" },
|
||||
{ "3.8.2", "_Toc141790700" },
|
||||
{ "3.8.2.1", "_Toc141790701" },
|
||||
{ "3.8.2.2", "_Toc141790702" },
|
||||
{ "3.9", "_Toc141790703" },
|
||||
{ "3.10", "_Toc141790704" },
|
||||
{ "3.10.1", "_Toc141790705" },
|
||||
{ "3.10.2", "_Toc141790706" },
|
||||
{ "3.10.3", "_Toc141790707" },
|
||||
{ "3.11", "_Toc141790709" },
|
||||
{ "3.11.1", "_Toc141790710" },
|
||||
{ "3.11.2", "_Toc141790711" },
|
||||
{ "3.11.3", "_Toc141790712" },
|
||||
{ "3.11.4", "_Toc141790713" },
|
||||
{ "3.11.4.1", "_Toc141790714" },
|
||||
{ "3.11.4.2", "_Toc141790715" },
|
||||
{ "3.11.5", "_Toc141790716" },
|
||||
{ "3.11.6", "_Toc141790717" },
|
||||
{ "3.11.7", "_Toc141790718" },
|
||||
{ "3.11.8", "_Toc141790719" },
|
||||
{ "3.11.9", "_Toc141790720" },
|
||||
{ "3.11.10", "_Toc141790721" },
|
||||
{ "3.11.11", "_Toc141790722" },
|
||||
{ "3.12", "_Toc141790723" },
|
||||
{ "3.12.1", "_Toc141790724" },
|
||||
{ "3.12.3", "_Toc141790726" },
|
||||
{ "3.12.4", "_Toc141790727" },
|
||||
{ "3.13", "_Toc141790728" },
|
||||
{ "3.13.1", "_Toc141790729" },
|
||||
{ "3.13.2", "_Toc141790730" },
|
||||
{ "3.13.3", "_Toc141790731" },
|
||||
{ "3.13.4", "_Toc141790732" },
|
||||
{ "3.14", "_Toc141790734" },
|
||||
{ "3.14.1", "_Toc141790735" },
|
||||
{ "3.14.3", "_Toc141790737" },
|
||||
{ "3.14.4", "_Toc141790738" },
|
||||
{ "3.14.5", "_Toc141790739" },
|
||||
{ "3.14.6", "_Toc141790740" },
|
||||
{ "3.14.7", "_Toc141790741" },
|
||||
{ "3.14.8", "_Toc141790742" },
|
||||
{ "3.14.9", "_Toc141790743" },
|
||||
{ "3.14.10", "_Toc141790744" },
|
||||
{ "3.14.11", "_Toc141790745" },
|
||||
{ "3.14.12", "_Toc141790746" },
|
||||
{ "3.14.14", "_Toc141790748" },
|
||||
{ "3.14.15", "_Toc141790749" },
|
||||
{ "3.14.16", "_Toc141790750" },
|
||||
{ "3.14.17", "_Toc141790751" },
|
||||
{ "3.14.18", "_Toc141790752" },
|
||||
{ "3.14.19", "_Toc141790753" },
|
||||
{ "3.14.20", "_Toc141790754" },
|
||||
{ "3.14.21", "_Toc141790755" },
|
||||
{ "3.14.22", "_Toc141790756" },
|
||||
{ "3.14.23", "_Toc141790757" },
|
||||
{ "3.14.24", "_Toc141790758" },
|
||||
{ "3.14.26", "_Toc141790760" },
|
||||
{ "3.14.27", "_Toc141790761" },
|
||||
{ "3.14.28", "_Toc141790762" },
|
||||
{ "3.15.1", "_Toc141790764" },
|
||||
{ "3.15.2", "_Toc141790765" },
|
||||
{ "3.15.3", "_Toc141790766" },
|
||||
{ "3.16.1", "_Toc141790768" },
|
||||
{ "3.16.2", "_Toc141790769" },
|
||||
{ "3.16.3", "_Toc141790770" },
|
||||
{ "3.16.4", "_Toc141790771" },
|
||||
{ "3.16.5", "_Toc141790772" },
|
||||
{ "3.17", "_Toc141790773" },
|
||||
{ "3.17.1", "_Toc141790774" },
|
||||
{ "3.17.2", "_Toc141790775" },
|
||||
{ "3.17.3", "_Toc141790776" },
|
||||
{ "3.17.4", "_Toc141790777" },
|
||||
{ "3.17.5", "_Toc141790778" },
|
||||
{ "3.18", "_Toc141790779" },
|
||||
{ "3.18.1", "_Toc141790780" },
|
||||
{ "3.18.2", "_Toc141790781" },
|
||||
{ "3.18.3", "_Toc141790782" },
|
||||
{ "3.19", "_Toc141790783" },
|
||||
{ "3.19.1", "_Toc141790784" },
|
||||
{ "3.19.2", "_Toc141790785" },
|
||||
{ "3.19.3", "_Toc141790786" },
|
||||
{ "3.19.4", "_Toc141790787" },
|
||||
{ "3.19.5", "_Toc141790788" },
|
||||
{ "3.19.6", "_Toc141790789" },
|
||||
{ "3.19.7", "_Toc141790790" },
|
||||
{ "3.19.8", "_Toc141790791" },
|
||||
{ "3.19.9", "_Toc141790792" },
|
||||
{ "3.19.10", "_Toc141790793" },
|
||||
{ "3.19.11", "_Toc141790794" },
|
||||
{ "3.19.12", "_Toc141790795" },
|
||||
{ "3.19.13", "_Toc141790796" },
|
||||
{ "3.19.15", "_Toc141790798" },
|
||||
{ "3.19.16", "_Toc141790799" },
|
||||
{ "3.19.17", "_Toc141790800" },
|
||||
{ "3.19.18", "_Toc141790801" },
|
||||
{ "3.19.19", "_Toc141790802" },
|
||||
{ "3.19.20", "_Toc141790803" },
|
||||
{ "3.19.21", "_Toc141790804" },
|
||||
{ "3.19.22", "_Toc141790805" },
|
||||
{ "3.19.23", "_Toc141790806" },
|
||||
{ "3.19.24", "_Toc141790807" },
|
||||
{ "3.19.25", "_Toc141790808" },
|
||||
{ "3.19.26", "_Toc141790809" },
|
||||
{ "3.19.27", "_Toc141790810" },
|
||||
{ "3.19.28", "_Toc141790811" },
|
||||
{ "3.19.29", "_Toc141790812" },
|
||||
{ "3.19.30", "_Toc141790813" },
|
||||
{ "3.19.33", "_Toc141790816" },
|
||||
{ "3.20", "_Toc141790817" },
|
||||
{ "3.20.1", "_Toc141790818" },
|
||||
{ "3.20.2", "_Toc141790819" },
|
||||
{ "3.20.3", "_Toc141790820" },
|
||||
{ "3.20.4", "_Toc141790821" },
|
||||
{ "3.20.7", "_Toc141790824" },
|
||||
{ "3.20.8", "_Toc141790825" },
|
||||
{ "3.20.9", "_Toc141790826" },
|
||||
{ "3.20.10", "_Toc141790827" },
|
||||
{ "3.20.11", "_Toc141790828" },
|
||||
{ "3.20.12", "_Toc141790829" },
|
||||
{ "3.20.14", "_Toc141790831" },
|
||||
{ "3.20.15", "_Toc141790832" },
|
||||
{ "3.20.16", "_Toc141790833" },
|
||||
{ "3.20.17", "_Toc141790834" },
|
||||
{ "3.20.18", "_Toc141790835" },
|
||||
{ "3.20.19", "_Toc141790836" },
|
||||
{ "3.20.20", "_Toc141790837" },
|
||||
{ "3.21", "_Toc141790841" },
|
||||
{ "3.21.1", "_Toc141790842" },
|
||||
{ "3.21.2", "_Toc141790843" },
|
||||
{ "3.21.3", "_Toc141790844" },
|
||||
{ "3.21.4", "_Toc141790845" },
|
||||
{ "3.21.5", "_Toc141790846" },
|
||||
{ "3.22", "_Toc141790847" },
|
||||
{ "3.22.1", "_Toc141790848" },
|
||||
{ "3.22.2", "_Toc141790849" },
|
||||
{ "3.22.3", "_Toc141790850" },
|
||||
{ "3.22.4", "_Toc141790851" },
|
||||
{ "3.23", "_Toc141790852" },
|
||||
{ "3.23.1", "_Toc141790853" },
|
||||
{ "3.23.2", "_Toc141790854" },
|
||||
{ "3.23.3", "_Toc141790855" },
|
||||
{ "3.23.4", "_Toc141790856" },
|
||||
{ "3.23.5", "_Toc141790857" },
|
||||
{ "3.23.6", "_Toc141790858" },
|
||||
{ "3.23.7", "_Toc141790859" },
|
||||
{ "3.23.8", "_Toc141790860" },
|
||||
{ "3.24", "_Toc141790861" },
|
||||
{ "3.24.1", "_Toc141790862" },
|
||||
{ "3.24.2", "_Toc141790863" },
|
||||
{ "3.24.3", "_Toc141790864" },
|
||||
{ "3.24.4", "_Toc141790865" },
|
||||
{ "3.24.5", "_Toc141790866" },
|
||||
{ "3.24.6", "_Toc141790867" },
|
||||
{ "3.24.7", "_Toc141790868" },
|
||||
{ "3.24.8", "_Toc141790869" },
|
||||
{ "3.24.9", "_Toc141790870" },
|
||||
{ "3.24.10", "_Toc141790871" },
|
||||
{ "3.24.10.1", "_Toc141790872" },
|
||||
{ "3.24.11", "_Toc141790874" },
|
||||
{ "3.24.12", "_Toc141790875" },
|
||||
{ "3.24.13", "_Toc141790876" },
|
||||
{ "3.25", "_Toc141790877" },
|
||||
{ "3.25.1", "_Toc141790878" },
|
||||
{ "3.25.2", "_Toc141790879" },
|
||||
{ "3.26", "_Toc141790880" },
|
||||
{ "3.26.1", "_Toc141790881" },
|
||||
{ "3.26.2", "_Toc141790882" },
|
||||
{ "3.26.3", "_Toc141790883" },
|
||||
{ "3.26.4", "_Toc141790884" },
|
||||
{ "3.26.5", "_Toc141790885" },
|
||||
{ "3.26.6", "_Toc141790886" },
|
||||
{ "3.26.7", "_Toc141790887" },
|
||||
{ "3.27", "_Toc141790888" },
|
||||
{ "3.27.1", "_Toc141790889" },
|
||||
{ "3.27.3", "_Toc141790891" },
|
||||
{ "3.27.4", "_Toc141790892" },
|
||||
{ "3.27.5", "_Toc141790893" },
|
||||
{ "3.27.6", "_Toc141790894" },
|
||||
{ "3.27.7", "_Toc141790895" },
|
||||
{ "3.27.8", "_Toc141790896" },
|
||||
{ "3.27.9", "_Toc141790897" },
|
||||
{ "3.27.10", "_Toc141790898" },
|
||||
{ "3.27.11", "_Toc141790899" },
|
||||
{ "3.27.12", "_Toc141790900" },
|
||||
{ "3.27.13", "_Toc141790901" },
|
||||
{ "3.27.14", "_Toc141790902" },
|
||||
{ "3.27.15", "_Toc141790903" },
|
||||
{ "3.27.16", "_Toc141790904" },
|
||||
{ "3.27.17", "_Toc141790905" },
|
||||
{ "3.27.18", "_Toc141790906" },
|
||||
{ "3.27.19", "_Toc141790907" },
|
||||
{ "3.27.20", "_Toc141790908" },
|
||||
{ "3.27.21", "_Toc141790909" },
|
||||
{ "3.27.22", "_Toc141790910" },
|
||||
{ "3.27.23", "_Toc141790911" },
|
||||
{ "3.27.24", "_Toc141790912" },
|
||||
{ "3.27.25", "_Toc141790913" },
|
||||
{ "3.27.26", "_Toc141790914" },
|
||||
{ "3.27.27", "_Toc141790915" },
|
||||
{ "3.27.28", "_Toc141790916" },
|
||||
{ "3.27.29", "_Toc141790917" },
|
||||
{ "3.27.30", "_Toc141790918" },
|
||||
{ "3.27.31", "_Toc141790919" },
|
||||
{ "3.28", "_Toc141790920" },
|
||||
{ "3.28.1", "_Toc141790921" },
|
||||
{ "3.28.2", "_Toc141790922" },
|
||||
{ "3.28.3", "_Toc141790923" },
|
||||
{ "3.28.4", "_Toc141790924" },
|
||||
{ "3.28.5", "_Toc141790925" },
|
||||
{ "3.28.6", "_Toc141790926" },
|
||||
{ "3.28.7", "_Toc141790927" },
|
||||
{ "3.29", "_Toc141790928" },
|
||||
{ "3.29.1", "_Toc141790929" },
|
||||
{ "3.29.2", "_Toc141790930" },
|
||||
{ "3.29.3", "_Toc141790931" },
|
||||
{ "3.29.4", "_Toc141790932" },
|
||||
{ "3.29.5", "_Toc141790933" },
|
||||
{ "3.29.6", "_Toc141790934" },
|
||||
{ "3.30", "_Toc141790935" },
|
||||
{ "3.30.1", "_Toc141790936" },
|
||||
{ "3.30.2", "_Toc141790937" },
|
||||
{ "3.30.3", "_Toc141790938" },
|
||||
{ "3.30.5", "_Toc141790940" },
|
||||
{ "3.30.6", "_Toc141790941" },
|
||||
{ "3.30.7", "_Toc141790942" },
|
||||
{ "3.30.8", "_Toc141790943" },
|
||||
{ "3.30.9", "_Toc141790944" },
|
||||
{ "3.30.10", "_Toc141790945" },
|
||||
{ "3.30.11", "_Toc141790946" },
|
||||
{ "3.30.12", "_Toc141790947" },
|
||||
{ "3.30.13", "_Toc141790948" },
|
||||
{ "3.30.14", "_Toc141790949" },
|
||||
{ "3.30.15", "_Toc141790950" },
|
||||
{ "3.31", "_Toc141790951" },
|
||||
{ "3.31.1", "_Toc141790952" },
|
||||
{ "3.31.3", "_Toc141790954" },
|
||||
{ "3.32", "_Toc141790955" },
|
||||
{ "3.32.1", "_Toc141790956" },
|
||||
{ "3.32.2", "_Toc141790957" },
|
||||
{ "3.32.3", "_Toc141790958" },
|
||||
{ "3.32.4", "_Toc141790959" },
|
||||
{ "3.32.5", "_Toc141790960" },
|
||||
{ "3.32.6", "_Toc141790961" },
|
||||
{ "3.32.7", "_Toc141790962" },
|
||||
{ "3.32.8", "_Toc141790963" },
|
||||
{ "3.32.9", "_Toc141790964" },
|
||||
{ "3.32.10", "_Toc141790965" },
|
||||
{ "3.32.11", "_Toc141790966" },
|
||||
{ "3.32.12", "_Toc141790967" },
|
||||
{ "3.32.13", "_Toc141790968" },
|
||||
{ "3.33", "_Toc141790969" },
|
||||
{ "3.33.1", "_Toc141790970" },
|
||||
{ "3.33.2", "_Toc141790971" },
|
||||
{ "3.33.3", "_Toc141790972" },
|
||||
{ "3.33.4", "_Toc141790973" },
|
||||
{ "3.33.5", "_Toc141790974" },
|
||||
{ "3.33.6", "_Toc141790975" },
|
||||
{ "3.33.7", "_Toc141790976" },
|
||||
{ "3.33.8", "_Toc141790977" },
|
||||
{ "3.34", "_Toc141790978" },
|
||||
{ "3.34.1", "_Toc141790979" },
|
||||
{ "3.34.2", "_Toc141790980" },
|
||||
{ "3.34.3", "_Toc141790981" },
|
||||
{ "3.34.4", "_Toc141790982" },
|
||||
{ "3.35", "_Toc141790983" },
|
||||
{ "3.35.1", "_Toc141790984" },
|
||||
{ "3.35.2", "_Toc141790985" },
|
||||
{ "3.35.3", "_Toc141790986" },
|
||||
{ "3.35.4", "_Toc141790987" },
|
||||
{ "3.35.5", "_Toc141790988" },
|
||||
{ "3.35.6", "_Toc141790989" },
|
||||
{ "3.36", "_Toc141790990" },
|
||||
{ "3.36.1", "_Toc141790991" },
|
||||
{ "3.36.2", "_Toc141790992" },
|
||||
{ "3.36.3", "_Toc141790993" },
|
||||
{ "3.37", "_Toc141790994" },
|
||||
{ "3.37.1", "_Toc141790995" },
|
||||
{ "3.37.2", "_Toc141790996" },
|
||||
{ "3.37.3", "_Toc141790997" },
|
||||
{ "3.37.4", "_Toc141790998" },
|
||||
{ "3.37.5", "_Toc141790999" },
|
||||
{ "3.37.6", "_Toc141791000" },
|
||||
{ "3.38", "_Toc141791001" },
|
||||
{ "3.38.1", "_Toc141791002" },
|
||||
{ "3.38.2", "_Toc141791003" },
|
||||
{ "3.38.3", "_Toc141791004" },
|
||||
{ "3.38.4", "_Toc141791005" },
|
||||
{ "3.38.5", "_Toc141791006" },
|
||||
{ "3.38.6", "_Toc141791007" },
|
||||
{ "3.38.7", "_Toc141791008" },
|
||||
{ "3.38.8", "_Toc141791009" },
|
||||
{ "3.38.9", "_Toc141791010" },
|
||||
{ "3.38.10", "_Toc141791011" },
|
||||
{ "3.38.11", "_Toc141791012" },
|
||||
{ "3.38.12", "_Toc141791013" },
|
||||
{ "3.38.13", "_Toc141791014" },
|
||||
{ "3.38.14", "_Toc141791015" },
|
||||
{ "3.39", "_Toc141791016" },
|
||||
{ "3.39.1", "_Toc141791017" },
|
||||
{ "3.39.2", "_Toc141791018" },
|
||||
{ "3.39.3", "_Toc141791019" },
|
||||
{ "3.39.4", "_Toc141791020" },
|
||||
{ "3.40", "_Toc141791021" },
|
||||
{ "3.40.1", "_Toc141791022" },
|
||||
{ "3.40.2", "_Toc141791023" },
|
||||
{ "3.40.3", "_Toc141791024" },
|
||||
{ "3.40.4", "_Toc141791025" },
|
||||
{ "3.40.5", "_Toc141791026" },
|
||||
{ "3.41", "_Toc141791027" },
|
||||
{ "3.41.1", "_Toc141791028" },
|
||||
{ "3.41.2", "_Toc141791029" },
|
||||
{ "3.41.3", "_Toc141791030" },
|
||||
{ "3.41.4", "_Toc141791031" },
|
||||
{ "3.41.5", "_Toc141791032" },
|
||||
{ "3.42", "_Toc141791033" },
|
||||
{ "3.42.1", "_Toc141791034" },
|
||||
{ "3.42.2", "_Toc141791035" },
|
||||
{ "3.42.3", "_Toc141791036" },
|
||||
{ "3.42.4", "_Toc141791037" },
|
||||
{ "3.42.5", "_Toc141791038" },
|
||||
{ "3.42.6", "_Toc141791039" },
|
||||
{ "3.42.7", "_Toc141791040" },
|
||||
{ "3.42.8", "_Toc141791041" },
|
||||
{ "3.43", "_Toc141791042" },
|
||||
{ "3.43.1", "_Toc141791043" },
|
||||
{ "3.43.2", "_Toc141791044" },
|
||||
{ "3.43.3", "_Toc141791045" },
|
||||
{ "3.43.4", "_Toc141791046" },
|
||||
{ "3.43.5", "_Toc141791047" },
|
||||
{ "3.44", "_Toc141791048" },
|
||||
{ "3.44.1", "_Toc141791049" },
|
||||
{ "3.44.2", "_Toc141791050" },
|
||||
{ "3.44.3", "_Toc141791051" },
|
||||
{ "3.45", "_Toc141791052" },
|
||||
{ "3.45.1", "_Toc141791053" },
|
||||
{ "3.45.2", "_Toc141791054" },
|
||||
{ "3.45.3", "_Toc141791055" },
|
||||
{ "3.45.4", "_Toc141791056" },
|
||||
{ "3.45.5", "_Toc141791057" },
|
||||
{ "3.46", "_Toc141791058" },
|
||||
{ "3.46.1", "_Toc141791059" },
|
||||
{ "3.46.2", "_Toc141791060" },
|
||||
{ "3.46.3", "_Toc141791061" },
|
||||
{ "3.46.4", "_Toc141791062" },
|
||||
{ "3.46.5", "_Toc141791063" },
|
||||
{ "3.46.6", "_Toc141791064" },
|
||||
{ "3.46.7", "_Toc141791065" },
|
||||
{ "3.46.8", "_Toc141791066" },
|
||||
{ "3.46.9", "_Toc141791067" },
|
||||
{ "3.47", "_Toc141791068" },
|
||||
{ "3.47.1", "_Toc141791069" },
|
||||
{ "3.47.2", "_Toc141791070" },
|
||||
{ "3.47.3", "_Toc141791071" },
|
||||
{ "3.47.4", "_Toc141791072" },
|
||||
{ "3.47.5", "_Toc141791073" },
|
||||
{ "3.47.6", "_Toc141791074" },
|
||||
{ "3.47.7", "_Toc141791075" },
|
||||
{ "3.47.8", "_Toc141791076" },
|
||||
{ "3.47.9", "_Toc141791077" },
|
||||
{ "3.48", "_Toc141791078" },
|
||||
{ "3.48.1", "_Toc141791079" },
|
||||
{ "3.48.2", "_Toc141791080" },
|
||||
{ "3.48.3", "_Toc141791081" },
|
||||
{ "3.48.4", "_Toc141791082" },
|
||||
{ "3.48.5", "_Toc141791083" },
|
||||
{ "3.48.6", "_Toc141791084" },
|
||||
{ "3.48.7", "_Toc141791085" },
|
||||
{ "3.49", "_Toc141791086" },
|
||||
{ "3.49.1", "_Toc141791087" },
|
||||
{ "3.49.2", "_Toc141791088" },
|
||||
{ "3.49.3", "_Toc141791089" },
|
||||
{ "3.49.4", "_Toc141791090" },
|
||||
{ "3.49.5", "_Toc141791091" },
|
||||
{ "3.49.6", "_Toc141791092" },
|
||||
{ "3.49.7", "_Toc141791093" },
|
||||
{ "3.49.8", "_Toc141791094" },
|
||||
{ "3.49.9", "_Toc141791095" },
|
||||
{ "3.49.10", "_Toc141791096" },
|
||||
{ "3.49.11", "_Toc141791097" },
|
||||
{ "3.49.12", "_Toc141791098" },
|
||||
{ "3.49.13", "_Toc141791099" },
|
||||
{ "3.49.14", "_Toc141791100" },
|
||||
{ "3.49.15", "_Toc141791101" },
|
||||
{ "3.50", "_Toc141791102" },
|
||||
{ "3.50.1", "_Toc141791103" },
|
||||
{ "3.50.2", "_Toc141791104" },
|
||||
{ "3.50.3", "_Toc141791105" },
|
||||
{ "3.50.4", "_Toc141791106" },
|
||||
{ "3.50.5", "_Toc141791107" },
|
||||
{ "3.51", "_Toc141791108" },
|
||||
{ "3.51.1", "_Toc141791109" },
|
||||
{ "3.51.2", "_Toc141791110" },
|
||||
{ "3.51.3", "_Toc141791111" },
|
||||
{ "3.52.1", "_Toc141791113" },
|
||||
{ "3.52.2", "_Toc141791114" },
|
||||
{ "3.52.3", "_Toc141791115" },
|
||||
{ "3.52.4", "_Toc141791116" },
|
||||
{ "3.52.5", "_Toc141791117" },
|
||||
{ "3.52.6", "_Toc141791118" },
|
||||
{ "3.52.7", "_Toc141791119" },
|
||||
{ "3.53.1", "_Toc141791121" },
|
||||
{ "3.53.2", "_Toc141791122" },
|
||||
{ "3.53.3", "_Toc141791123" },
|
||||
{ "3.53.4", "_Toc141791124" },
|
||||
{ "3.54", "_Toc141791125" },
|
||||
{ "3.54.1", "_Toc141791126" },
|
||||
{ "3.54.2", "_Toc141791127" },
|
||||
{ "3.54.3", "_Toc141791128" },
|
||||
{ "3.54.4", "_Toc141791129" },
|
||||
{ "3.54.5", "_Toc141791130" },
|
||||
{ "3.55", "_Toc141791131" },
|
||||
{ "3.55.1", "_Toc141791132" },
|
||||
{ "3.55.2", "_Toc141791133" },
|
||||
{ "3.55.3", "_Toc141791134" },
|
||||
{ "3.56", "_Toc141791135" },
|
||||
{ "3.56.1", "_Toc141791136" },
|
||||
{ "3.56.2", "_Toc141791137" },
|
||||
{ "3.56.3", "_Toc141791138" },
|
||||
{ "3.57", "_Toc141791139" },
|
||||
{ "3.57.1", "_Toc141791140" },
|
||||
{ "3.57.2", "_Toc141791141" },
|
||||
{ "3.57.3", "_Toc141791142" },
|
||||
{ "3.57.4", "_Toc141791143" },
|
||||
{ "3.58", "_Toc141791144" },
|
||||
{ "3.58.1", "_Toc141791145" },
|
||||
{ "3.58.2", "_Toc141791146" },
|
||||
{ "3.58.3", "_Toc141791147" },
|
||||
{ "3.58.4", "_Toc141791148" },
|
||||
{ "3.58.5", "_Toc141791149" },
|
||||
{ "3.58.6", "_Toc141791150" },
|
||||
{ "3.58.7", "_Toc141791151" },
|
||||
{ "3.58.8", "_Toc141791152" },
|
||||
{ "3.58.9", "_Toc141791153" },
|
||||
{ "3.59", "_Toc141791154" },
|
||||
{ "3.59.1", "_Toc141791155" },
|
||||
{ "3.59.2", "_Toc141791156" },
|
||||
{ "3.59.3", "_Toc141791157" },
|
||||
{ "3.59.4", "_Toc141791158" },
|
||||
{ "3.59.5", "_Toc141791159" },
|
||||
{ "4.1", "_Toc141791161" },
|
||||
{ "4.3", "_Toc141791163" },
|
||||
{ "4.3.1", "_Toc141791164" },
|
||||
{ "4.3.2", "_Toc141791165" },
|
||||
{ "4.3.3", "_Toc141791166" },
|
||||
{ "4.3.4", "_Toc141791167" },
|
||||
{ "4.3.5", "_Toc141791168" },
|
||||
{ "4.3.6", "_Toc141791169" },
|
||||
{ "5.1", "_Toc141791171" },
|
||||
{ "5.5", "_Toc141791175" },
|
||||
{ "5.8", "_Toc141791178" },
|
||||
};
|
@ -273,6 +273,10 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
|
||||
# created or not. If it was, dg.exp will try to run it.
|
||||
catch { remote_file build delete $output_file }
|
||||
}
|
||||
"replay-sarif" {
|
||||
set compile_type "none"
|
||||
set output_file ""
|
||||
}
|
||||
default {
|
||||
perror "$do_what: not a valid dg-do keyword"
|
||||
return ""
|
||||
|
90
gcc/testsuite/lib/sarif-replay-dg.exp
Normal file
90
gcc/testsuite/lib/sarif-replay-dg.exp
Normal file
@ -0,0 +1,90 @@
|
||||
# Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
# Define sarif-replay callbacks for dg.exp.
|
||||
|
||||
proc sarif-replay-dg-test { prog do_what extra_tool_flags } {
|
||||
upvar dg-do-what dg-do-what
|
||||
|
||||
set result \
|
||||
[gcc-dg-test-1 sarif-replay_target_compile $prog "replay-sarif" $extra_tool_flags]
|
||||
|
||||
set comp_output [lindex $result 0]
|
||||
set output_file [lindex $result 1]
|
||||
|
||||
return [list $comp_output $output_file]
|
||||
}
|
||||
|
||||
proc sarif-replay-dg-prune { system text } {
|
||||
return [gcc-dg-prune $system $text]
|
||||
}
|
||||
|
||||
# Utility routines.
|
||||
|
||||
#
|
||||
# Modified dg-runtest that can cycle through a list of optimization options
|
||||
# as c-torture does.
|
||||
#
|
||||
|
||||
proc sarif-replay-dg-runtest { testcases flags default-extra-flags } {
|
||||
global runtests
|
||||
|
||||
foreach test $testcases {
|
||||
# If we're only testing specific files and this isn't one of
|
||||
# them, skip it.
|
||||
if ![runtest_file_p $runtests $test] {
|
||||
continue
|
||||
}
|
||||
|
||||
# Use TORTURE_OPTIONS to cycle through an option list.
|
||||
if [torture-options-exist] then {
|
||||
global torture_with_loops
|
||||
set option_list $torture_with_loops
|
||||
} else {
|
||||
set option_list { "" }
|
||||
}
|
||||
|
||||
set nshort [file tail [file dirname $test]]/[file tail $test]
|
||||
|
||||
foreach flags_t $option_list {
|
||||
verbose "Testing $nshort, $flags $flags_t" 1
|
||||
dg-test $test "$flags $flags_t" ${default-extra-flags}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# sarif-replay_load -- wrapper around default sarif-replay_load to handle tests that
|
||||
# require program arguments passed to them.
|
||||
#
|
||||
|
||||
if { [info procs sarif-replay_load] != [list] \
|
||||
&& [info procs prev_sarif-replay_load] == [list] } {
|
||||
rename sarif-replay_load prev_sarif-replay_load
|
||||
|
||||
proc sarif-replay_load { program args } {
|
||||
global SARIF_REPLAY_EXECUTE_ARGS
|
||||
if [info exists SARIF_REPLAY_EXECUTE_ARGS] then {
|
||||
set args [concat "{$SARIF_REPLAY_EXECUTE_ARGS}"]
|
||||
}
|
||||
#print "Running: $program [lindex $args 0]"
|
||||
set result [eval [list prev_sarif-replay_load $program] $args ]
|
||||
return $result
|
||||
}
|
||||
}
|
||||
|
204
gcc/testsuite/lib/sarif-replay.exp
Normal file
204
gcc/testsuite/lib/sarif-replay.exp
Normal file
@ -0,0 +1,204 @@
|
||||
# Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# sarif-replay support library routines
|
||||
#
|
||||
|
||||
load_lib prune.exp
|
||||
load_lib gcc-defs.exp
|
||||
load_lib timeout.exp
|
||||
load_lib target-libpath.exp
|
||||
|
||||
#
|
||||
# SARIF_REPLAY_UNDER_TEST is the compiler under test.
|
||||
#
|
||||
|
||||
set sarif-replay_compile_options ""
|
||||
|
||||
|
||||
#
|
||||
# sarif-replay_version -- extract and print the version number of the compiler
|
||||
#
|
||||
|
||||
proc sarif-replay_version { } {
|
||||
global SARIF_REPLAY_UNDER_TEST
|
||||
|
||||
sarif-replay_init
|
||||
|
||||
# ignore any arguments after the command
|
||||
set compiler [lindex $SARIF_REPLAY_UNDER_TEST 0]
|
||||
|
||||
# verify that the compiler exists
|
||||
if { [is_remote host] || [which $compiler] != 0 } then {
|
||||
set tmp [remote_exec host "$compiler -v"]
|
||||
set status [lindex $tmp 0]
|
||||
set output [lindex $tmp 1]
|
||||
regexp " version \[^\n\r\]*" $output version
|
||||
if { $status == 0 && [info exists version] } then {
|
||||
if [is_remote host] {
|
||||
clone_output "$compiler $version\n"
|
||||
} else {
|
||||
clone_output "[which $compiler] $version\n"
|
||||
}
|
||||
} else {
|
||||
clone_output "Couldn't determine version of [which $compiler]\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# sarif-replay_include_flags -- include flags for the gcc tree structure
|
||||
#
|
||||
|
||||
proc sarif-replay_include_flags { paths } {
|
||||
global srcdir
|
||||
global SARIF-REPLAY_INCLUDE_CXX_FLAGS
|
||||
global TESTING_IN_BUILD_TREE
|
||||
|
||||
set flags ""
|
||||
|
||||
if { [is_remote host] || ![info exists TESTING_IN_BUILD_TREE] } {
|
||||
return "${flags}"
|
||||
}
|
||||
|
||||
if [info exists SARIF-REPLAY_INCLUDE_CXX_FLAGS] {
|
||||
set include_cxx_flags $SARIF-REPLAY_INCLUDE_CXX_FLAGS
|
||||
} else {
|
||||
set include_cxx_flags 0
|
||||
}
|
||||
|
||||
set gccpath ${paths}
|
||||
|
||||
if { $gccpath != "" } {
|
||||
if [file exists "${gccpath}/libphobos/libdruntime"] {
|
||||
append flags "-I${gccpath}/libphobos/libdruntime "
|
||||
}
|
||||
}
|
||||
append flags "-I${srcdir}/../../libphobos/libdruntime "
|
||||
append flags "-I${srcdir}/../../libphobos/src "
|
||||
|
||||
# For the tests that mix C++ and D, need to know where headers are located.
|
||||
if $include_cxx_flags {
|
||||
set odir [lookfor_file ${gccpath} libstdc++-v3]
|
||||
if { ${odir} != "" && [file exists ${odir}/scripts/testsuite_flags] } {
|
||||
set cxxflags [exec sh ${odir}/scripts/testsuite_flags --build-includes]
|
||||
set idx [lsearch $cxxflags "-nostdinc++"]
|
||||
append flags [lreplace $cxxflags $idx $idx]
|
||||
}
|
||||
}
|
||||
|
||||
return "$flags"
|
||||
}
|
||||
|
||||
#
|
||||
# sarif-replay_init -- called at the start of each subdir of tests
|
||||
#
|
||||
|
||||
proc sarif-replay_init { args } {
|
||||
global sarif-replay_initialized
|
||||
global base_dir
|
||||
global tmpdir
|
||||
global libdir
|
||||
global gluefile wrap_flags
|
||||
global TOOL_EXECUTABLE
|
||||
global SARIF_REPLAY_UNDER_TEST
|
||||
global TESTING_IN_BUILD_TREE
|
||||
global gcc_warning_prefix
|
||||
global gcc_error_prefix
|
||||
|
||||
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
|
||||
setenv LC_ALL C
|
||||
setenv LANG C
|
||||
|
||||
if ![info exists SARIF_REPLAY_UNDER_TEST] then {
|
||||
if [info exists TOOL_EXECUTABLE] {
|
||||
set SARIF_REPLAY_UNDER_TEST $TOOL_EXECUTABLE
|
||||
} else {
|
||||
if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
|
||||
set SARIF_REPLAY_UNDER_TEST [transform sarif-replay]
|
||||
} else {
|
||||
set SARIF_REPLAY_UNDER_TEST [findfile $base_dir/../../sarif-replay "$base_dir/../../sarif-replay" [findfile $base_dir/sarif-replay "$base_dir/sarif-replay" [transform sarif-replay]]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
verbose "SARIF_REPLAY_UNDER_TEST: $SARIF_REPLAY_UNDER_TEST" 2
|
||||
|
||||
if ![is_remote host] {
|
||||
if { [which $SARIF_REPLAY_UNDER_TEST] == 0 } then {
|
||||
perror "SARIF_REPLAY_UNDER_TEST ($SARIF_REPLAY_UNDER_TEST) does not exist"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
if ![info exists tmpdir] {
|
||||
set tmpdir "/tmp"
|
||||
}
|
||||
|
||||
if [info exists gluefile] {
|
||||
unset gluefile
|
||||
}
|
||||
|
||||
set gcc_warning_prefix "warning:"
|
||||
set gcc_error_prefix "(fatal )?error:"
|
||||
|
||||
verbose "sarif-replay is initialized" 3
|
||||
}
|
||||
|
||||
#
|
||||
# sarif-replay_target_compile -- compile a source file
|
||||
#
|
||||
|
||||
proc sarif-replay_target_compile { source dest type options } {
|
||||
global tmpdir
|
||||
global gluefile wrap_flags
|
||||
global SARIF_REPLAY_UNDER_TEST
|
||||
global TOOL_OPTIONS
|
||||
global TEST_ALWAYS_FLAGS
|
||||
|
||||
if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
lappend options "ldflags=${wrap_flags}"
|
||||
}
|
||||
|
||||
set always_sarif_replay_flags ""
|
||||
|
||||
# FIXME: strip out -fdiagnostics-plain-output from TEST_ALWAYS_FLAGS
|
||||
# rather than hacking this out:
|
||||
#
|
||||
# TEST_ALWAYS_FLAGS are flags that should be passed to every
|
||||
# compilation. They are passed first to allow individual
|
||||
# tests to override them.
|
||||
## if [info exists TEST_ALWAYS_FLAGS] {
|
||||
## lappend always_sarif_replay_flags "additional_flags=$TEST_ALWAYS_FLAGS"
|
||||
## }
|
||||
|
||||
if [info exists TOOL_OPTIONS] {
|
||||
lappend always_sarif_replay_flags "additional_flags=$TOOL_OPTIONS"
|
||||
}
|
||||
|
||||
verbose "always_sarif_replay_flags set to: $always_sarif_replay_flags"
|
||||
|
||||
lappend options "timeout=[timeout_value]"
|
||||
lappend options "compiler=$SARIF_REPLAY_UNDER_TEST"
|
||||
|
||||
set options [concat "$always_sarif_replay_flags" $options]
|
||||
set options [dg-additional-files-options $options $source $dest $type]
|
||||
return [target_compile $source $dest $type $options]
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
[ null ] // { dg-error "expected a sarifLog object as the top-level value \\\[SARIF v2.1.0 §3.1\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
1 | [ null ]
|
||||
| ^~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [{
|
||||
"tool": { "driver": { "name": "example" } },
|
||||
"results": [
|
||||
{ "message": { "text" : "before {} after" }, /* { dg-error "unescaped '\\\{' within message string \\\[SARIF v2.1.0 §3.11.11\\\]" } */
|
||||
"locations": [] }
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
6 | { "message": { "text" : "before {} after" },
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [{
|
||||
"tool": { "driver": { "name": "example" } },
|
||||
"results": [
|
||||
{ "message": { "text" : "the {0} {1} fox jumps over the {2} dog" } } /* { dg-error "message string contains placeholder '\\{0\\}' but message object has no 'arguments' property \\\[SARIF v2.1.0 §3.11.11\\\]" } */
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
6 | { "message": { "text" : "the {0} {1} fox jumps over the {2} dog" } }
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [{
|
||||
"tool": { "driver": { "name": "example" } },
|
||||
"results": [
|
||||
{ "message": { "text" : "the {0} {1} fox jumps over the {2} dog", "arguments": ["quick", "brown"] } } /* { dg-error "not enough strings in 'arguments' array for placeholder '\\{2\\}' \\\[SARIF v2.1.0 §3.11.11\\\]" } */
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
6 | { "message": { "text" : "the {0} {1} fox jumps over the {2} dog", "arguments": ["quick", "brown"] } }
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,6 @@
|
||||
{ } // { dg-error "expected sarifLog object to have a 'version' property \\\[SARIF v2.1.0 §3.13.2\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
1 | { }
|
||||
| ^~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,6 @@
|
||||
{ "version" : 42 } // { dg-error "15: expected sarifLog.version to be a JSON string; got JSON number \\\[SARIF v2.1.0 §3.13.2\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
1 | { "version" : 42 }
|
||||
| ^~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,7 @@
|
||||
{ "version": "2.1.0",
|
||||
"runs": 42 } // { dg-error "expected sarifLog.runs to be 'null' or an array \\\[SARIF v2.1.0 §3.13.4\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
2 | "runs": 42 }
|
||||
| ^~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,6 @@
|
||||
{ "version": "2.1.0" } // { dg-error "expected sarifLog object to have a 'runs' property \\\[SARIF v2.1.0 §3.13.4\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
1 | { "version": "2.1.0" }
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,7 @@
|
||||
{ "version": "2.1.0",
|
||||
"runs" : [42] } // { dg-error "expected element of sarifLog.runs array to be an object \\\[SARIF v2.1.0 §3.13.4\\\]" }
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
2 | "runs" : [42] }
|
||||
| ^~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "foo"
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"level": "mostly harmless", /* { dg-error "unrecognized value for 'level': 'mostly harmless' \\\[SARIF v2.1.0 §3.27.10\\\]" } */
|
||||
"message": {
|
||||
"text": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
12 | "level": "mostly harmless",
|
||||
| ^~~~~~~~~~~~~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "foo"
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"level": "none", /* { dg-message "sorry, unimplemented: unable to handle value for 'level': 'none' \\\[SARIF v2.1.0 §3.27.10\\\]" } */
|
||||
"message": {
|
||||
"text": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
12 | "level": "none",
|
||||
| ^~~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,34 @@
|
||||
{"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
||||
"version": "2.1.0",
|
||||
"runs": [{"tool": {"driver": {"name": "FooScanner",
|
||||
"rules": []}},
|
||||
"artifacts": [{"location": {"uri": "/this/does/not/exist/test.bas"},
|
||||
"sourceLanguage": "basic",
|
||||
"contents": {"text": "label: PRINT \"hello world!\"\n GOTO label\n"},
|
||||
"roles": ["analysisTarget"]}],
|
||||
"results": [{"ruleId": "error",
|
||||
"level": "error",
|
||||
"message": {"text": "'GOTO' is considered harmful"},
|
||||
"locations": [{"physicalLocation": {"artifactLocation": {"uri": "/this/does/not/exist/test.bas"},
|
||||
"region": {"startLine": 2,
|
||||
"startColumn": 8,
|
||||
"endColumn": 19},
|
||||
"contextRegion": {"startLine": 2,
|
||||
"snippet": {"text": " GOTO label\n"}}}}],
|
||||
"relatedLocations": [{"physicalLocation": {"artifactLocation": {"uri": "/this/does/not/exist/test.bas"},
|
||||
"region": {"startLine": 1,
|
||||
"startColumn": 1,
|
||||
"endColumn": 6},
|
||||
"contextRegion": {"startLine": 1,
|
||||
"snippet": {"text": "PRINT \"hello world!\";\n"}}},
|
||||
"message": {"text": "this is the target of the 'GOTO'"}}]}]}]}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
/this/does/not/exist/test.bas:2:8: error: 'GOTO' is considered harmful
|
||||
{ dg-end-multiline-output "" } */
|
||||
/* { dg-begin-multiline-output "" }
|
||||
/this/does/not/exist/test.bas:1:1: note: this is the target of the 'GOTO'
|
||||
{ dg-end-multiline-output "" } */
|
||||
|
||||
// TODO: quote the source
|
||||
// TODO: trailing [error]
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [{
|
||||
"tool": { "driver": { "name": "example" } },
|
||||
"results": [
|
||||
{ "message": { "text" : "before open '{{' after open" },
|
||||
"locations": []},
|
||||
{ "message": { "text" : "before close '}}' after close" },
|
||||
"locations": []}
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
example: warning: before open '{' after open
|
||||
example: warning: before close '}' after close
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,2 @@
|
||||
{ "version": "2.1.0",
|
||||
"runs": null }
|
193
gcc/testsuite/sarif-replay.dg/2.1.0-valid/signal-1.c.sarif
Normal file
193
gcc/testsuite/sarif-replay.dg/2.1.0-valid/signal-1.c.sarif
Normal file
@ -0,0 +1,193 @@
|
||||
/* Test a replay of a .sarif file generated from GCC testsuite.
|
||||
|
||||
The dg directives were stripped out from the generated .sarif
|
||||
to avoid confusing DejaGnu for this test. */
|
||||
|
||||
{"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
||||
"version": "2.1.0",
|
||||
"runs": [{"tool": {"driver": {"name": "GNU C17",
|
||||
"fullName": "GNU C17 (GCC) version 15.0.0 20240709 (experimental) (x86_64-pc-linux-gnu)",
|
||||
"version": "15.0.0 20240709 (experimental)",
|
||||
"informationUri": "https://gcc.gnu.org/gcc-15/",
|
||||
"rules": [{"id": "-Wanalyzer-unsafe-call-within-signal-handler",
|
||||
"helpUri": "https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-unsafe-call-within-signal-handler"}]}},
|
||||
"taxonomies": [{"name": "CWE",
|
||||
"version": "4.7",
|
||||
"organization": "MITRE",
|
||||
"shortDescription": {"text": "The MITRE Common Weakness Enumeration"},
|
||||
"taxa": [{"id": "479",
|
||||
"helpUri": "https://cwe.mitre.org/data/definitions/479.html"}]}],
|
||||
"invocations": [{"executionSuccessful": true,
|
||||
"toolExecutionNotifications": []}],
|
||||
"originalUriBaseIds": {"PWD": {"uri": "file:///home/david/coding/gcc-newgit-more-taint/build/gcc/"}},
|
||||
"artifacts": [{"location": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"sourceLanguage": "c",
|
||||
"contents": {"text": "/* Example of a bad call within a signal handler.\n 'handler' calls 'custom_logger' which calls 'fprintf', and 'fprintf' is\n not allowed from a signal handler. */\n\n\n#include <stdio.h>\n#include <signal.h>\n\nextern void body_of_program(void);\n\nvoid custom_logger(const char *msg)\n{\n fprintf(stderr, \"LOG: %s\", msg);\n}\n\nstatic void handler(int signum)\n{\n custom_logger(\"got signal\");\n}\n\nint main(int argc, const char *argv)\n{\n custom_logger(\"started\");\n\n signal(SIGINT, handler);\n\n body_of_program();\n\n custom_logger(\"stopped\");\n\n return 0;\n}\n"},
|
||||
"roles": ["analysisTarget",
|
||||
"tracedFile"]}],
|
||||
"results": [{"ruleId": "-Wanalyzer-unsafe-call-within-signal-handler",
|
||||
"taxa": [{"id": "479",
|
||||
"toolComponent": {"name": "cwe"}}],
|
||||
"properties": {"gcc/analyzer/saved_diagnostic/sm": "signal",
|
||||
"gcc/analyzer/saved_diagnostic/enode": 57,
|
||||
"gcc/analyzer/saved_diagnostic/snode": 11,
|
||||
"gcc/analyzer/saved_diagnostic/state": "in_signal_handler",
|
||||
"gcc/analyzer/saved_diagnostic/idx": 0},
|
||||
"level": "warning",
|
||||
"message": {"text": "call to ‘fprintf’ from within signal handler"},
|
||||
"locations": [{"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 13,
|
||||
"startColumn": 3,
|
||||
"endColumn": 34},
|
||||
"contextRegion": {"startLine": 13,
|
||||
"snippet": {"text": " fprintf(stderr, \"LOG: %s\", msg);\n"}}},
|
||||
"logicalLocations": [{"name": "custom_logger",
|
||||
"fullyQualifiedName": "custom_logger",
|
||||
"decoratedName": "custom_logger",
|
||||
"kind": "function"}]}],
|
||||
"codeFlows": [{"threadFlows": [{"id": "main",
|
||||
"locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_FUNCTION_ENTRY"},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 21,
|
||||
"startColumn": 5,
|
||||
"endColumn": 9},
|
||||
"contextRegion": {"startLine": 21,
|
||||
"snippet": {"text": "int main(int argc, const char *argv)\n"}}},
|
||||
"logicalLocations": [{"name": "main",
|
||||
"fullyQualifiedName": "main",
|
||||
"decoratedName": "main",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "entry to ‘main’"}},
|
||||
"kinds": ["enter",
|
||||
"function"],
|
||||
"nestingLevel": 1,
|
||||
"executionOrder": 1},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_STATE_CHANGE"},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 25,
|
||||
"startColumn": 3,
|
||||
"endColumn": 26},
|
||||
"contextRegion": {"startLine": 25,
|
||||
"snippet": {"text": " signal(SIGINT, handler);\n"}}},
|
||||
"logicalLocations": [{"name": "main",
|
||||
"fullyQualifiedName": "main",
|
||||
"decoratedName": "main",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "registering ‘handler’ as signal handler"}},
|
||||
"nestingLevel": 1,
|
||||
"executionOrder": 2},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_CUSTOM"},
|
||||
"location": {"message": {"text": "later on, when the signal is delivered to the process"}},
|
||||
"nestingLevel": 0,
|
||||
"executionOrder": 3},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_FUNCTION_ENTRY"},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 16,
|
||||
"startColumn": 13,
|
||||
"endColumn": 20},
|
||||
"contextRegion": {"startLine": 16,
|
||||
"snippet": {"text": "static void handler(int signum)\n"}}},
|
||||
"logicalLocations": [{"name": "handler",
|
||||
"fullyQualifiedName": "handler",
|
||||
"decoratedName": "handler",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "entry to ‘handler’"}},
|
||||
"kinds": ["enter",
|
||||
"function"],
|
||||
"nestingLevel": 1,
|
||||
"executionOrder": 4},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_CALL_EDGE",
|
||||
"gcc/analyzer/superedge_event/superedge": {"kind": "SUPEREDGE_CALL",
|
||||
"src_idx": 7,
|
||||
"dst_idx": 10,
|
||||
"desc": "call"}},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 18,
|
||||
"startColumn": 3,
|
||||
"endColumn": 30},
|
||||
"contextRegion": {"startLine": 18,
|
||||
"snippet": {"text": " custom_logger(\"got signal\");\n"}}},
|
||||
"logicalLocations": [{"name": "handler",
|
||||
"fullyQualifiedName": "handler",
|
||||
"decoratedName": "handler",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "calling ‘custom_logger’ from ‘handler’"}},
|
||||
"kinds": ["call",
|
||||
"function"],
|
||||
"nestingLevel": 1,
|
||||
"executionOrder": 5},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(6)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_FUNCTION_ENTRY"},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 11,
|
||||
"startColumn": 6,
|
||||
"endColumn": 19},
|
||||
"contextRegion": {"startLine": 11,
|
||||
"snippet": {"text": "void custom_logger(const char *msg)\n"}}},
|
||||
"logicalLocations": [{"name": "custom_logger",
|
||||
"fullyQualifiedName": "custom_logger",
|
||||
"decoratedName": "custom_logger",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "entry to ‘custom_logger’"}},
|
||||
"kinds": ["enter",
|
||||
"function"],
|
||||
"nestingLevel": 2,
|
||||
"executionOrder": 6},
|
||||
{"properties": {"gcc/analyzer/checker_event/emission_id": "(7)",
|
||||
"gcc/analyzer/checker_event/kind": "EK_WARNING"},
|
||||
"location": {"physicalLocation": {"artifactLocation": {"uri": "../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c",
|
||||
"uriBaseId": "PWD"},
|
||||
"region": {"startLine": 13,
|
||||
"startColumn": 3,
|
||||
"endColumn": 34},
|
||||
"contextRegion": {"startLine": 13,
|
||||
"snippet": {"text": " fprintf(stderr, \"LOG: %s\", msg);\n"}}},
|
||||
"logicalLocations": [{"name": "custom_logger",
|
||||
"fullyQualifiedName": "custom_logger",
|
||||
"decoratedName": "custom_logger",
|
||||
"kind": "function"}],
|
||||
"message": {"text": "call to ‘fprintf’ from within signal handler"}},
|
||||
"kinds": ["danger"],
|
||||
"nestingLevel": 2,
|
||||
"executionOrder": 7}]}]}]}]}]}
|
||||
|
||||
// TODO: replay the source code
|
||||
// TODO: show the CWE
|
||||
/* { dg-begin-multiline-output "" }
|
||||
../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c:13:3: warning: call to ‘fprintf’ from within signal handler [-Wanalyzer-unsafe-call-within-signal-handler]
|
||||
'main': event 1
|
||||
|
|
||||
|
|
||||
'main': event 2
|
||||
|
|
||||
|
|
||||
event 3
|
||||
|
|
||||
|GNU C17:
|
||||
| (3): later on, when the signal is delivered to the process
|
||||
|
|
||||
+--> 'handler': event 4
|
||||
|
|
||||
|
|
||||
'handler': event 5
|
||||
|
|
||||
|
|
||||
+--> 'custom_logger': event 6
|
||||
|
|
||||
|
|
||||
'custom_logger': event 7
|
||||
|
|
||||
|
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,15 @@
|
||||
// Taken from SARIF v2.1.0, Appendix K.1: "Minimal valid SARIF log file"
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "CodeScanner"
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/* Taken from SARIF v2.1.0, Appendix K.2: "Minimal recommended SARIF log
|
||||
file with source information". */
|
||||
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "CodeScanner",
|
||||
"rules": [
|
||||
{
|
||||
"id": "C2001",
|
||||
"fullDescription": {
|
||||
"text": "A variable was used without being initialized. This can result in runtime errors such as null reference exceptions."
|
||||
},
|
||||
"messageStrings": {
|
||||
"default": {
|
||||
"text": "Variable \"{0}\" was used without being initialized."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifacts": [
|
||||
{
|
||||
"location": {
|
||||
"uri": "src/collections/list.cpp",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"sourceLanguage": "c"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "C2001",
|
||||
"ruleIndex": 0,
|
||||
"message": {
|
||||
"id": "default",
|
||||
"arguments": [
|
||||
"count"
|
||||
]
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "src/collections/list.cpp",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 0
|
||||
},
|
||||
"region": {
|
||||
"startLine": 15
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
In function 'collections::list::add':
|
||||
src/collections/list.cpp:15: warning: Variable "count" was used without being initialized. [C2001]
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,65 @@
|
||||
/* Taken from SARIF v2.1.0, Appendix K.3: "Minimal recommended SARIF log
|
||||
file without source information". */
|
||||
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "BinaryScanner"
|
||||
}
|
||||
},
|
||||
"artifact": [
|
||||
{
|
||||
"location": {
|
||||
"uri": "bin/example",
|
||||
"uriBaseId": "BINROOT"
|
||||
}
|
||||
}
|
||||
],
|
||||
"logicalLocations": [
|
||||
{
|
||||
"name": "Example",
|
||||
"kind": "namespace"
|
||||
},
|
||||
{
|
||||
"name": "Worker",
|
||||
"fullyQualifiedName": "Example.Worker",
|
||||
"kind": "type",
|
||||
"parentIndex": 0
|
||||
},
|
||||
{
|
||||
"name": "DoWork",
|
||||
"fullyQualifiedName": "Example.Worker.DoWork",
|
||||
"kind": "function",
|
||||
"parentIndex": 1
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "B6412",
|
||||
"message": {
|
||||
"text": "The insecure method \"Crypto.Sha1.Encrypt\" should not be used."
|
||||
},
|
||||
"level": "warning",
|
||||
"locations": [
|
||||
{
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "Example.Worker.DoWork",
|
||||
"index": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
In function 'Example.Worker.DoWork':
|
||||
BinaryScanner: warning: The insecure method "Crypto.Sha1.Encrypt" should not be used. [B6412]
|
||||
{ dg-end-multiline-output "" } */
|
766
gcc/testsuite/sarif-replay.dg/2.1.0-valid/spec-example-4.sarif
Normal file
766
gcc/testsuite/sarif-replay.dg/2.1.0-valid/spec-example-4.sarif
Normal file
@ -0,0 +1,766 @@
|
||||
/* Taken from SARIF v2.1.0, Appendix K.4: "Comprehensive SARIF file". */
|
||||
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
||||
"runs": [
|
||||
{
|
||||
"automationId": {
|
||||
"guid": "BC650830-A9FE-44CB-8818-AD6C387279A0",
|
||||
"id": "Nightly code scan/2018-10-08"
|
||||
},
|
||||
"baselineGuid": "0A106451-C9B1-4309-A7EE-06988B95F723",
|
||||
"runAggregates": [
|
||||
{
|
||||
"id": "Build/14.0.1.2/Release/20160716-13:22:18",
|
||||
"correlationGuid": "26F138B6-6014-4D3D-B174-6E1ACE9439F3"
|
||||
}
|
||||
],
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "CodeScanner",
|
||||
"fullName": "CodeScanner 1.1 for Microsoft Windows (R) (en-US)",
|
||||
"version": "2.1",
|
||||
"semanticVersion": "2.1.0",
|
||||
"dottedQuadFileVersion": "2.1.0.0",
|
||||
"releaseDateUtc": "2019-03-17",
|
||||
"organization": "Example Corporation",
|
||||
"product": "Code Scanner",
|
||||
"productSuite": "Code Quality Tools",
|
||||
"shortDescription": {
|
||||
"text": "A scanner for code."
|
||||
},
|
||||
"fullDescription": {
|
||||
"text": "A really great scanner for all your code."
|
||||
},
|
||||
"properties": {
|
||||
"copyright": "Copyright (c) 2017 by Example Corporation."
|
||||
},
|
||||
"globalMessageStrings": {
|
||||
"variableDeclared": {
|
||||
"text": "Variable \"{0}\" was declared here.",
|
||||
"markdown": " Variable `{0}` was declared here."
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"id": "C2001",
|
||||
"deprecatedIds": [
|
||||
"CA2000"
|
||||
],
|
||||
"defaultConfiguration": {
|
||||
"level": "error",
|
||||
"rank": 95
|
||||
},
|
||||
"shortDescription": {
|
||||
"text": "A variable was used without being initialized."
|
||||
},
|
||||
"fullDescription": {
|
||||
"text": "A variable was used without being initialized. This can result in runtime errors such as null reference exceptions."
|
||||
},
|
||||
"messageStrings": {
|
||||
"default": {
|
||||
"text": "Variable \"{0}\" was used without being initialized. It was declared [here]({1}).",
|
||||
"markdown": "Variable `{0}` was used without being initialized. It was declared [here]({1})."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"notifications": [
|
||||
{
|
||||
"id": "start",
|
||||
"shortDescription": {
|
||||
"text": "The run started."
|
||||
},
|
||||
"messageStrings": {
|
||||
"default": {
|
||||
"text": "Run started."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "end",
|
||||
"shortDescription": {
|
||||
"text": "The run ended."
|
||||
},
|
||||
"messageStrings": {
|
||||
"default": {
|
||||
"text": "Run ended."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"language": "en-US"
|
||||
},
|
||||
"extensions": [
|
||||
{
|
||||
"name": "CodeScanner Security Rules",
|
||||
"version": "3.1",
|
||||
"rules": [
|
||||
{
|
||||
"id": "S0001",
|
||||
"defaultConfiguration": {
|
||||
"level": "error"
|
||||
},
|
||||
"shortDescription": {
|
||||
"text": "Do not use weak cryptographic algorithms."
|
||||
},
|
||||
"messageStrings": {
|
||||
"default": {
|
||||
"text": "The cryptographic algorithm '{0}' should not be used."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"language": "en-US",
|
||||
"versionControlProvenance": [
|
||||
{
|
||||
"repositoryUri": "https://github.com/example-corp/browser",
|
||||
"revisionId": "5da53fbb2a0aaa12d648b73984acc9aac2e11c2a",
|
||||
"mappedTo": {
|
||||
"uriBaseId": "PROJECTROOT"
|
||||
}
|
||||
}
|
||||
],
|
||||
"originalUriBaseIds": {
|
||||
"PROJECTROOT": {
|
||||
"uri": "file://build.example.com/work/"
|
||||
},
|
||||
"SRCROOT": {
|
||||
"uri": " src/",
|
||||
"uriBaseId": "PROJECTROOT"
|
||||
},
|
||||
"BINROOT": {
|
||||
"uri": " bin/",
|
||||
"uriBaseId": "PROJECTROOT"
|
||||
}
|
||||
},
|
||||
"invocations": [
|
||||
{
|
||||
"commandLine": "CodeScanner @build/collections.rsp",
|
||||
"responseFiles": [
|
||||
{
|
||||
"uri": "build/collections.rsp",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"startTimeUtc": "2016-07-16T14:18:25Z",
|
||||
"endTimeUtc": "2016-07-16T14:19:01Z",
|
||||
"machine": "BLD01",
|
||||
"account": "buildAgent",
|
||||
"processId": 1218,
|
||||
"fileName": "/bin/tools/CodeScanner",
|
||||
"workingDirectory": {
|
||||
"uri": "file:///home/buildAgent/src"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "/usr/local/bin:/bin:/bin/tools:/home/buildAgent/bin",
|
||||
"HOME": "/home/buildAgent",
|
||||
"TZ": "EST"
|
||||
},
|
||||
"toolConfigurationNotifications": [
|
||||
{
|
||||
"descriptor": {
|
||||
"id": "UnknownRule"
|
||||
},
|
||||
"associatedRule": {
|
||||
"ruleId": "ABC0001"
|
||||
},
|
||||
"level": "warning",
|
||||
"message": {
|
||||
"text": "Could not disable rule \"ABC0001\" because there is no rule with that id."
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolExecutionNotifications": [
|
||||
{
|
||||
"descriptor": {
|
||||
"id": "CTN0001"
|
||||
},
|
||||
"level": "note",
|
||||
"message": {
|
||||
"text": "Run started."
|
||||
}
|
||||
},
|
||||
{
|
||||
"descriptor": {
|
||||
"id": "CTN9999"
|
||||
},
|
||||
"associatedRule": {
|
||||
"id": "C2001",
|
||||
"index": 0
|
||||
},
|
||||
"level": "error",
|
||||
"message": {
|
||||
"text": "Exception evaluating rule \"C2001\". Rule disabled; run continues."
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "crypto/hash.cpp",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"threadId": 52,
|
||||
"timeUtc": "2016-07-16T14:18:43.119Z",
|
||||
"exception": {
|
||||
"kind": "ExecutionEngine.RuleFailureException",
|
||||
"message": "Unhandled exception during rule evaluation.",
|
||||
"stack": {
|
||||
"frames": [
|
||||
{
|
||||
"location": {
|
||||
"message": {
|
||||
"text": "Exception thrown"
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName":
|
||||
"Rules.SecureHashAlgorithmRule.Evaluate"
|
||||
}
|
||||
],
|
||||
"physicalLocation": {
|
||||
"address": {
|
||||
"offset": 4244988
|
||||
}
|
||||
}
|
||||
},
|
||||
"module": "RuleLibrary",
|
||||
"threadId": 52
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName":
|
||||
"ExecutionEngine.Engine.EvaluateRule"
|
||||
}
|
||||
],
|
||||
"physicalLocation": {
|
||||
"address": {
|
||||
"offset": 4245514
|
||||
}
|
||||
}
|
||||
},
|
||||
"module": "ExecutionEngine",
|
||||
"threadId": 52
|
||||
}
|
||||
]
|
||||
},
|
||||
"innerExceptions": [
|
||||
{
|
||||
"kind": "System.ArgumentException",
|
||||
"message": "length is < 0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"descriptor": {
|
||||
"id": "CTN0002"
|
||||
},
|
||||
"level": "note",
|
||||
"message": {
|
||||
"text": "Run ended."
|
||||
}
|
||||
}
|
||||
],
|
||||
"exitCode": 0,
|
||||
"executionSuccessful": true
|
||||
}
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"location": {
|
||||
"uri": "build/collections.rsp",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"mimeType": "text/plain",
|
||||
"length": 81,
|
||||
"contents": {
|
||||
"text": "-input src/collections/*.cpp -log out/collections.sarif -rules all -disable C9999"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "application/main.cpp",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"sourceLanguage": "cplusplus",
|
||||
"length": 1742,
|
||||
"hashes": {
|
||||
"sha-256": "cc8e6a99f3eff00adc649fee132ba80fe333ea5a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "collections/list.cpp",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"sourceLanguage": "cplusplus",
|
||||
"length": 980,
|
||||
"hashes": {
|
||||
"sha-256": "b13ce2678a8807ba0765ab94a0ecd394f869bc81"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"sourceLanguage": "cplusplus",
|
||||
"length": 24656,
|
||||
"hashes": {
|
||||
"sha-256": "849be119aaba4e9f88921a99e3036fb6c2a8144a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "crypto/hash.cpp",
|
||||
"uriBaseId": "SRCROOT"
|
||||
},
|
||||
"sourceLanguage": "cplusplus",
|
||||
"length": 1424,
|
||||
"hashes": {
|
||||
"sha-256": "3ffe2b77dz255cdf95f97d986d7a6ad8f287eaed"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "app.zip",
|
||||
"uriBaseId": "BINROOT"
|
||||
},
|
||||
"mimeType": "application/zip",
|
||||
"length": 310450,
|
||||
"hashes": {
|
||||
"sha-256": "df18a5e74b6b46ddaa23ad7271ee2b7c5731cbe1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"uri": "/docs/intro.docx"
|
||||
},
|
||||
"mimeType":
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"parentIndex": 5,
|
||||
"offset": 17522,
|
||||
"length": 4050
|
||||
}
|
||||
],
|
||||
"logicalLocations": [
|
||||
{
|
||||
"name": "add",
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"decoratedName": "?add@list@collections@@QAEXH@Z",
|
||||
"kind": "function",
|
||||
"parentIndex": 1
|
||||
},
|
||||
{
|
||||
"name": "list",
|
||||
"fullyQualifiedName": "collections::list",
|
||||
"kind": "type",
|
||||
"parentIndex": 2
|
||||
},
|
||||
{
|
||||
"name": "collections",
|
||||
"kind": "namespace"
|
||||
},
|
||||
{
|
||||
"name": "add_core",
|
||||
"fullyQualfiedName": "collections::list::add_core",
|
||||
"decoratedName": "?add_core@list@collections@@QAEXH@Z",
|
||||
"kind": "function",
|
||||
"parentIndex": 1
|
||||
},
|
||||
{
|
||||
"fullyQualifiedName": "main",
|
||||
"kind": "function"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "C2001",
|
||||
"ruleIndex": 0,
|
||||
"kind": "fail",
|
||||
"level": "error",
|
||||
"message": {
|
||||
"id": "default",
|
||||
"arguments": [
|
||||
"ptr",
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"suppressions": [
|
||||
{
|
||||
"kind": "external",
|
||||
"status": "accepted"
|
||||
}
|
||||
],
|
||||
"baselineState": "unchanged",
|
||||
"rank": 95,
|
||||
"analysisTarget": {
|
||||
"uri": "collections/list.cpp",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 2
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 15,
|
||||
"startColumn": 9,
|
||||
"endLine": 15,
|
||||
"endColumn": 10,
|
||||
"charLength": 1,
|
||||
"charOffset": 254,
|
||||
"snippet": {
|
||||
"text": "add_core(ptr, offset, val);\n return;"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"relatedLocations": [
|
||||
{
|
||||
"id": 0,
|
||||
"message": {
|
||||
"id": "variableDeclared",
|
||||
"arguments": [
|
||||
"ptr"
|
||||
]
|
||||
},
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 8,
|
||||
"startColumn": 5
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"codeFlows": [
|
||||
{
|
||||
"message": {
|
||||
"text": "Path from declaration to usage"
|
||||
},
|
||||
|
||||
"threadFlows": [
|
||||
{
|
||||
"id": "thread-52",
|
||||
"locations": [
|
||||
{
|
||||
"importance": "essential",
|
||||
"location": {
|
||||
"message": {
|
||||
"text": "Variable \"ptr\" declared.",
|
||||
"markdown": "Variable `ptr` declared."
|
||||
},
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri":"collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 15,
|
||||
"snippet": {
|
||||
"text": "int *ptr;"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "platform"
|
||||
},
|
||||
{
|
||||
"state": {
|
||||
"y": {
|
||||
"text": "2"
|
||||
},
|
||||
"z": {
|
||||
"text": "4"
|
||||
},
|
||||
"y + z": {
|
||||
"text": "6"
|
||||
},
|
||||
"q": {
|
||||
"text": "7"
|
||||
}
|
||||
},
|
||||
"importance": "unimportant",
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri":"collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 15,
|
||||
"snippet": {
|
||||
"text": "offset = (y + z) * q + 1;"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"annotations": [
|
||||
{
|
||||
"startLine": 15,
|
||||
"startColumn": 13,
|
||||
"endColumn": 19,
|
||||
"message": {
|
||||
"text": "(y + z) = 42",
|
||||
"markdown": "`(y + z) = 42`"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "platform"
|
||||
},
|
||||
{
|
||||
"importance": "essential",
|
||||
"location": {
|
||||
"message": {
|
||||
"text": "Uninitialized variable \"ptr\" passed to method \"add_core\".",
|
||||
"markdown": "Uninitialized variable `ptr` passed to method `add_core`."
|
||||
},
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri":"collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 25,
|
||||
"snippet": {
|
||||
"text": "add_core(ptr, offset, val)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "platform"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stacks": [
|
||||
{
|
||||
"message": {
|
||||
"text": "Call stack resulting from usage of uninitialized variable."
|
||||
},
|
||||
"frames": [
|
||||
{
|
||||
"location": {
|
||||
"message": {
|
||||
"text": "Exception thrown."
|
||||
},
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 110,
|
||||
"startColumn": 15
|
||||
},
|
||||
"address": {
|
||||
"offset": 4229178
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add_core",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "platform",
|
||||
"threadId": 52,
|
||||
"parameters": [ "null", "0", "14" ]
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"region": {
|
||||
"startLine": 43,
|
||||
"startColumn": 15
|
||||
},
|
||||
"address": {
|
||||
"offset": 4229268
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "collections::list::add",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "platform",
|
||||
"threadId": 52,
|
||||
"parameters": [ "14" ]
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "application/main.cpp",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 1
|
||||
},
|
||||
"region": {
|
||||
"startLine": 28,
|
||||
"startColumn": 9
|
||||
},
|
||||
"address": {
|
||||
"offset": 4229836
|
||||
}
|
||||
},
|
||||
"logicalLocations": [
|
||||
{
|
||||
"fullyQualifiedName": "main",
|
||||
"index": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"module": "application",
|
||||
"threadId": 52
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"addresses": [
|
||||
{
|
||||
"baseAddress": 4194304,
|
||||
"fullyQualifiedName": "collections.dll",
|
||||
"kind": "module",
|
||||
"section": ".text"
|
||||
},
|
||||
{
|
||||
"offset": 100,
|
||||
"fullyQualifiedName": "collections.dll!collections::list::add",
|
||||
"kind": "function",
|
||||
"parentIndex": 0
|
||||
},
|
||||
{
|
||||
"offset": 22,
|
||||
"fullyQualifiedName": "collections.dll!collections::list::add+0x16",
|
||||
"parentIndex": 1
|
||||
}
|
||||
],
|
||||
"fixes": [
|
||||
{
|
||||
"description": {
|
||||
"text": "Initialize the variable to null"
|
||||
},
|
||||
"artifactChanges": [
|
||||
{
|
||||
"artifactLocation": {
|
||||
"uri": "collections/list.h",
|
||||
"uriBaseId": "SRCROOT",
|
||||
"index": 3
|
||||
},
|
||||
"replacements": [
|
||||
{
|
||||
"deletedRegion": {
|
||||
"startLine": 42
|
||||
},
|
||||
"insertedContent": {
|
||||
"text": "A different line\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"hostedViewerUri":
|
||||
"https://www.example.com/viewer/3918d370-c636-40d8-bf23-8c176043a2df",
|
||||
"workItemUris": [
|
||||
"https://github.com/example/project/issues/42",
|
||||
"https://github.com/example/project/issues/54"
|
||||
],
|
||||
"provenance": {
|
||||
"firstDetectionTimeUtc": "2016-07-15T14:20:42Z",
|
||||
"firstDetectionRunGuid": "8F62D8A0-C14F-4516-9959-1A663BA6FB99",
|
||||
"lastDetectionTimeUtc": "2016-07-16T14:20:42Z",
|
||||
"lastDetectionRunGuid": "BC650830-A9FE-44CB-8818-AD6C387279A0",
|
||||
"invocationIndex": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
In function 'collections::list::add':
|
||||
collections/list.h:15:9: error: Variable "ptr" was used without being initialized. It was declared [here](0). [C2001]
|
||||
event 1
|
||||
|
|
||||
|
|
||||
event 2
|
||||
|
|
||||
|
|
||||
event 3
|
||||
|
|
||||
|
|
||||
{ dg-end-multiline-output "" } */
|
||||
/* { dg-begin-multiline-output "" }
|
||||
collections/list.h:8:5: note: Variable "ptr" was declared here.
|
||||
{ dg-end-multiline-output "" } */
|
||||
|
||||
// TODO: what's up with the events?
|
117
gcc/testsuite/sarif-replay.dg/2.1.0-valid/tutorial-example.sarif
Normal file
117
gcc/testsuite/sarif-replay.dg/2.1.0-valid/tutorial-example.sarif
Normal file
@ -0,0 +1,117 @@
|
||||
/* Adapted from https://github.com/microsoft/sarif-tutorials
|
||||
samples/bad-eval-with-code-flow.sarif.
|
||||
which is licensed under the Creative Commons Attribution 4.0 International Public License
|
||||
and/or the MIT License. */
|
||||
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "PythonScanner"
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "PY2335",
|
||||
"message": {
|
||||
"text": "Use of tainted variable 'raw_input' in the insecure function 'eval'."
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "bad-eval-with-code-flow.py"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"codeFlows": [
|
||||
{
|
||||
"message": {
|
||||
"text": "Tracing the path from user input to insecure usage."
|
||||
},
|
||||
"threadFlows": [
|
||||
{
|
||||
"locations": [
|
||||
{
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "bad-eval-with-code-flow.py"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"expr": {
|
||||
"text": "undef"
|
||||
}
|
||||
},
|
||||
"nestingLevel": 0
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "bad-eval-with-code-flow.py"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 6
|
||||
}
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"expr": {
|
||||
"text": "42"
|
||||
}
|
||||
},
|
||||
"nestingLevel": 0
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "bad-eval-with-code-flow.py"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 10
|
||||
}
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"raw_input": {
|
||||
"text": "42"
|
||||
}
|
||||
},
|
||||
"nestingLevel": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
bad-eval-with-code-flow.py:10: warning: Use of tainted variable 'raw_input' in the insecure function 'eval'. [PY2335]
|
||||
events 1-2
|
||||
|
|
||||
|
|
||||
+--> event 3
|
||||
|
|
||||
|
|
||||
{ dg-end-multiline-output "" } */
|
||||
|
||||
// TODO: show path even when we can't find the source
|
||||
// TODO: show path when we can find the source
|
46
gcc/testsuite/sarif-replay.dg/dg.exp
Normal file
46
gcc/testsuite/sarif-replay.dg/dg.exp
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (C) 2023-2024 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GCC.
|
||||
#
|
||||
# GCC is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free
|
||||
# Software Foundation; either version 3, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# GCC testsuite that uses the `dg.exp' driver.
|
||||
|
||||
# Load support procs.
|
||||
load_lib sarif-replay-dg.exp
|
||||
|
||||
global DEFAULT_SARIF_REPLAY_FLAGS
|
||||
if [info exists DEFAULT_SARIF_REPLAY_FLAGS] then {
|
||||
set save_default_sarif_replay_flags $DEFAULT_SARIF_REPLAY_FLAGS
|
||||
}
|
||||
|
||||
# If a testcase doesn't have special options, use these.
|
||||
set DEFAULT_SARIF_REPLAY_FLAGS "-fjson-comments -fdiagnostics-color=never"
|
||||
|
||||
# Initialize `dg'.
|
||||
dg-init
|
||||
|
||||
# Main loop.
|
||||
sarif-replay-dg-runtest [lsort \
|
||||
[glob -nocomplain $srcdir/$subdir/*/*.sarif ] ] "" $DEFAULT_SARIF_REPLAY_FLAGS
|
||||
|
||||
# All done.
|
||||
dg-finish
|
||||
|
||||
if [info exists save_default_sarif_replay_flags] {
|
||||
set DEFAULT_SARIF_REPLAY_FLAGS $save_default_sarif_replay_flags
|
||||
} else {
|
||||
unset DEFAULT_SARIF_REPLAY_FLAGS
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
["foo", "bar" "baz"] /* { dg-error "expected ',' or '\]'; got string" } */
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
1 | ["foo", "bar" "baz"]
|
||||
| ^~~~~
|
||||
{ dg-end-multiline-output "" } */
|
@ -0,0 +1,6 @@
|
||||
[ 0, 1, 2, ] /* { dg-error "expected a JSON value but got '\\\]'" } */
|
||||
|
||||
{ dg-begin-multiline-output "" }
|
||||
1 | [ 0, 1, 2, ]
|
||||
| ^
|
||||
{ dg-end-multiline-output "" }
|
@ -0,0 +1,6 @@
|
||||
not a valid JSON file // { dg-error "invalid JSON token: unexpected character: 'n'" }
|
||||
|
||||
{ dg-begin-multiline-output "" }
|
||||
1 | not a valid JSON file
|
||||
| ^
|
||||
{ dg-end-multiline-output "" }
|
@ -0,0 +1,7 @@
|
||||
{ "foo": "bar"
|
||||
"baz": 42 } // { dg-error "expected ',' or '\}'; got string" }
|
||||
|
||||
{ dg-begin-multiline-output "" }
|
||||
2 | "baz": 42 }
|
||||
| ^~~~~
|
||||
{ dg-end-multiline-output "" }
|
@ -0,0 +1,6 @@
|
||||
{ "foo": "bar", } /* { dg-error "expected string for object key after ','; got '\\\}'" } */
|
||||
|
||||
{ dg-begin-multiline-output "" }
|
||||
1 | { "foo": "bar", }
|
||||
| ^
|
||||
{ dg-end-multiline-output "" }
|
Loading…
Reference in New Issue
Block a user