diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ChangeLog | 47 | ||||
-rw-r--r-- | contrib/dg-extract-results.py | 3 | ||||
-rwxr-xr-x | contrib/dg-extract-results.sh | 8 | ||||
-rwxr-xr-x | contrib/dg-lint/dg-lint | 8 | ||||
-rw-r--r-- | contrib/dg-lint/libgdiagnostics.py | 17 | ||||
-rwxr-xr-x | contrib/diffsummary.py | 103 | ||||
-rwxr-xr-x | contrib/filter-clang-warnings.py | 35 | ||||
-rwxr-xr-x | contrib/gen_autofdo_event.py | 21 | ||||
-rwxr-xr-x | contrib/mklog.py | 6 | ||||
-rwxr-xr-x | contrib/prepare-commit-msg | 2 |
10 files changed, 234 insertions, 16 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 11a5c7b..a1db267 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,50 @@ +2025-07-07 Martin Jambor <mjambor@suse.cz> + + * filter-clang-warnings.py (skip_warning): Also ignore + -Woverloaded-shift-op-parentheses, -Wunused-function, + -Wunneeded-internal-declaration, -Wvla-cxx-extension', and + -Wunused-command-line-argument everywhere and a warning about + m_logical_loc_mgr in diagnostic-path-output.cc. Adjust gimple-match + and generic-match "filenames." Ignore -Wnontrivial-memcall warnings + in wide-int.h, all warnings about unused stuff in files under + m2/gm2-compiler-boot, all -Wunused-private-field in rust FE, in + analyzer/ana-state-to-diagnostic-state.h and c-family/c-format.cc, all + Warnings in avr-mmcu.texi, install.texi and libgccjit.texi and all + -Wc23-extensions warnings in libiberty/sha1.c. Ignore + -Wunused-parameter in analyzer/sm.cc. Reorder entries. + +2025-06-29 Filip Kastl <fkastl@suse.cz> + + * mklog.py: In 'main()', specify variable 'root' as global. + +2025-06-26 Alex Coplan <alex.coplan@arm.com> + + * mklog.py (main): New. + +2025-06-23 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + PR testsuite/116163 + PR sarif-replay/120792 + * dg-lint/dg-lint: Add -fdiagnostics-add-output. + * dg-lint/libgdiagnostics.py: Add + diagnostic_manager_add_sink_from_spec. + (Manager.add_sink_from_spec): New. + +2025-06-23 Andrew Burgess <aburgess@redhat.com> + + * dg-extract-results.py: Handle GDB's unexpected core file count. + * dg-extract-results.sh: Likewise. + +2025-05-27 Jan Hubicka <hubicka@ucw.cz> + + * gen_autofdo_event.py: Add support for AMD Zen 3 and + later CPUs. + +2025-05-23 Andi Kleen <ak@gcc.gnu.org> + + * diffsummary.py: New file. + 2025-05-09 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> * check_GNU_style_lib.py: Remove literal prefix. diff --git a/contrib/dg-extract-results.py b/contrib/dg-extract-results.py index f539275..c5bfbca 100644 --- a/contrib/dg-extract-results.py +++ b/contrib/dg-extract-results.py @@ -146,7 +146,8 @@ class Prog: '# of unresolved testcases\t', '# of unsupported tests\t\t', '# of paths in test names\t', - '# of duplicate test names\t' + '# of duplicate test names\t', + '# of unexpected core files\t' ] self.runs = dict() diff --git a/contrib/dg-extract-results.sh b/contrib/dg-extract-results.sh index c2f7604..d64ba25 100755 --- a/contrib/dg-extract-results.sh +++ b/contrib/dg-extract-results.sh @@ -403,7 +403,7 @@ BEGIN { variant="$VAR" tool="$TOOL" passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kpasscnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0; dgerrorcnt=0; - pathcnt=0; dupcnt=0 + pathcnt=0; dupcnt=0; corecnt=0 curvar=""; insummary=0 } /^Running target / { curvar = \$3; next } @@ -420,6 +420,7 @@ BEGIN { /^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; } /^# of paths in test names/ { if (insummary == 1) pathcnt += \$7; next; } /^# of duplicate test names/ { if (insummary == 1) dupcnt += \$6; next; } +/^# of unexpected core files/ { if (insummary == 1) corecnt += \$6; next; } /^$/ { if (insummary == 1) { insummary = 0; curvar = "" } next @@ -439,6 +440,7 @@ END { if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) if (pathcnt != 0) printf ("# of paths in test names\t%d\n", pathcnt) if (dupcnt != 0) printf ("# of duplicate test names\t%d\n", dupcnt) + if (corecnt != 0) printf ("# of unexpected core files\t%d\n", corecnt) } EOF @@ -460,7 +462,7 @@ cat << EOF > $TOTAL_AWK BEGIN { tool="$TOOL" passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0; dgerrorcnt=0 - pathcnt=0; dupcnt=0 + pathcnt=0; dupcnt=0; corecnt=0 } /^# of DejaGnu errors/ { dgerrorcnt += \$5 } /^# of expected passes/ { passcnt += \$5 } @@ -474,6 +476,7 @@ BEGIN { /^# of unsupported tests/ { unsupcnt += \$5 } /^# of paths in test names/ { pathcnt += \$7 } /^# of duplicate test names/ { dupcnt += \$6 } +/^# of unexpected core files/ { corecnt += \$6 } END { printf ("\n\t\t=== %s Summary ===\n\n", tool) if (dgerrorcnt != 0) printf ("# of DejaGnu errors\t\t%d\n", dgerrorcnt) @@ -488,6 +491,7 @@ END { if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) if (pathcnt != 0) printf ("# of paths in test names\t%d\n", pathcnt) if (dupcnt != 0) printf ("# of duplicate test names\t%d\n", dupcnt) + if (corecnt != 0) printf ("# of unexpected core files\t%d\n", corecnt) } EOF diff --git a/contrib/dg-lint/dg-lint b/contrib/dg-lint/dg-lint index 01d58d7..4ae0686 100755 --- a/contrib/dg-lint/dg-lint +++ b/contrib/dg-lint/dg-lint @@ -380,9 +380,17 @@ def skip_file(filename): def main(argv): parser = argparse.ArgumentParser()#usage=__doc__) parser.add_argument('paths', nargs='+', type=pathlib.Path) + parser.add_argument('-fdiagnostics-add-output', action='append') opts = parser.parse_args(argv[1:]) ctxt = Context() + control_mgr = libgdiagnostics.Manager() + control_mgr.add_text_sink() + for scheme in opts.fdiagnostics_add_output: + ctxt.mgr.add_sink_from_spec("-fdiagnostics-add-output=", + scheme, + control_mgr) + for path in opts.paths: if path.is_dir(): for dirpath, dirnames, filenames in os.walk(path): diff --git a/contrib/dg-lint/libgdiagnostics.py b/contrib/dg-lint/libgdiagnostics.py index 03a6440..8c8cc48 100644 --- a/contrib/dg-lint/libgdiagnostics.py +++ b/contrib/dg-lint/libgdiagnostics.py @@ -124,6 +124,13 @@ cdll.diagnostic_add_fix_it_hint_replace.argtypes \ ctypes.c_char_p] cdll.diagnostic_add_fix_it_hint_replace.restype = None +cdll.diagnostic_manager_add_sink_from_spec.argtypes \ + = [c_diagnostic_manager_ptr, + ctypes.c_char_p, + ctypes.c_char_p, + c_diagnostic_manager_ptr] +cdll.diagnostic_manager_add_sink_from_spec.restype = ctypes.c_int + # Helper functions def _to_utf8(s: str): @@ -156,6 +163,16 @@ class Manager: c_stderr, DIAGNOSTIC_COLORIZE_IF_TTY) + def add_sink_from_spec(self, option_name: str, scheme: str, control_mgr): + assert self.c_mgr + assert control_mgr.c_mgr + res = cdll.diagnostic_manager_add_sink_from_spec (self.c_mgr, + _to_utf8(option_name), + _to_utf8(scheme), + control_mgr.c_mgr) + if res: + raise RuntimeError() + def get_file(self, path: str, sarif_lang: str = None): assert self.c_mgr assert path diff --git a/contrib/diffsummary.py b/contrib/diffsummary.py new file mode 100755 index 0000000..c4aeba2 --- /dev/null +++ b/contrib/diffsummary.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +# Show or diff test_summary output to latest posted test result for a platform +# test_summary -t | diffsummary.py (compare test result from current build to last posted) +# diffsummary.py --show (only show last posted) +from urllib.request import urlopen +from html.parser import HTMLParser +import time +import re +import argparse +import platform +import tempfile +import os +import sys + +baseurl = "https://gcc.gnu.org/pipermail/gcc-testresults/" + +ap = argparse.ArgumentParser(description="Diff stdin to latest posted test result and set exit code to result") +ap.add_argument("--branch", default="experimental", + help="Branch to match (regex substring match)") +ap.add_argument("--arch", default=platform.machine() + ".*" + platform.system().lower(), + help="architecture to match (regex substring match)") +ap.add_argument("--retrytime", default=1, type=int, + help="time to wait before fetching next page (fractional seconds)") +ap.add_argument("--show", help="Show last test result, but do not diff", action="store_true", default=False) +ap.add_argument("--url", help="Show URLs downloaded", action="store_true") +ap.add_argument("--diff", help="Diff program to use (default diff)", default="diff") +ap.add_argument("--diff-args", help="Diff arguments to use (default -u)", default="-u") +ap.add_argument("--skip", type=int, default=0, help="Skip first N posted test results") +args = ap.parse_args() + +class ParseMonths(HTMLParser): + def __init__(self): + super().__init__() + self.months = [] + def handle_starttag(self, tag, attrs): + if tag == "a" and "thread.html" in attrs[0][1]: + self.months.append(attrs[0][1]) + +class ParseThread(HTMLParser): + def __init__(self): + super().__init__() + self.link = None + self.target = [] + def handle_starttag(self, tag, attrs): + if (tag == "a" + and attrs[0][1][0].isdigit() + and attrs[0][1].endswith(".html")): + self.link = attrs[0][1] + else: + self.link = None + def handle_data(self, data): + if (self.link + and re.search(args.branch, data) + and re.search(args.arch, data)): + self.target.append(thread.link) + +class ParseArticle(HTMLParser): + def __init__(self): + super().__init__() + self.contents = None + self.pre = False + self.data = None + def handle_starttag(self, tag, attrs): + self.pre = tag == "pre" + def handle_data(self, data): + if self.pre and not self.data: + self.data = data + +def my_urlopen(url): + if args.url: + print(url) + return urlopen(url) + +with my_urlopen(baseurl) as index: + months = ParseMonths() + months.feed(index.read().decode('utf-8')) +if len(months.months) == 0: + sys.exit("no months found") +for month in months.months: + with my_urlopen(baseurl + month) as m: + thread = ParseThread() + thread.feed(m.read().decode('utf-8')) + if thread.target: + if args.skip > len(thread.target): + args.skip -= len(thread.target) + continue + url = (baseurl + month).replace("thread.html", thread.target[-1 - args.skip]) + with my_urlopen(url) as t: + article = ParseArticle() + article.feed(t.read().decode('utf-8')) + if args.show: + print(article.data) + break + with tempfile.NamedTemporaryFile(delete=False) as tf: + tf.write(article.data.encode('utf-8')) + tf.close() + cmd = f"{args.diff} {args.diff_args} - {tf.name}" + print(cmd) + ret = os.system(cmd) + os.unlink(tf.name) + sys.exit(ret) + break + time.sleep(args.retrytime) diff --git a/contrib/filter-clang-warnings.py b/contrib/filter-clang-warnings.py index 2ea7c71..b1b881e 100755 --- a/contrib/filter-clang-warnings.py +++ b/contrib/filter-clang-warnings.py @@ -41,22 +41,43 @@ def skip_warning(filename, message): '-Wignored-attributes', '-Wgnu-zero-variadic-macro-arguments', '-Wformat-security', '-Wundefined-internal', '-Wunknown-warning-option', '-Wc++20-extensions', - '-Wbitwise-instead-of-logical', 'egrep is obsolescent'], + '-Wbitwise-instead-of-logical', 'egrep is obsolescent', + '-Woverloaded-shift-op-parentheses', + '-Wunused-function', '-Wunneeded-internal-declaration', + '-Wvla-cxx-extension', '-Wunused-command-line-argument'], + + 'diagnostic-path-output.cc': ['m_logical_loc_mgr'], + 'fold-const-call.cc': ['-Wreturn-type'], + 'gimple-match': ['-Wunused-', '-Wtautological-compare'], + 'generic-match': ['-Wunused-', '-Wtautological-compare'], + 'genautomata.cc': ['-Wstring-plus-int'], + # Perhaps revisit when ATTR_FNSPEC_DECONST_WATERMARK ifdef case is + # made default or removed: + 'ipa-strub.cc': ['-Wunused-but-set-variable'], 'insn-modes.cc': ['-Wshift-count-overflow'], 'insn-emit.cc': ['-Wtautological-compare'], 'insn-attrtab.cc': ['-Wparentheses-equality'], - 'gimple-match.cc': ['-Wunused-', '-Wtautological-compare'], - 'generic-match.cc': ['-Wunused-', '-Wtautological-compare'], + 'omp-builtins.def': ['-Wc++11-narrowing'], + 'wide-int.h': ['-Wnontrivial-memcall'], 'i386.md': ['-Wparentheses-equality', '-Wtautological-compare', '-Wtautological-overlap-compare'], 'sse.md': ['-Wparentheses-equality', '-Wtautological-compare', '-Wconstant-logical-operand'], 'mmx.md': ['-Wtautological-compare'], - 'genautomata.cc': ['-Wstring-plus-int'], - 'fold-const-call.cc': ['-Wreturn-type'], - 'gfortran.texi': [''], - 'libtool': [''], 'lex.cc': ['-Wc++20-attribute-extensions'], + # Perhaps remove once PR 120960 is resolved: + 'analyzer/ana-state-to-diagnostic-state.h': ['-Wunused-private-field'], + 'analyzer/sm.cc': ['-Wunused-parameter'], + 'c-family/c-format.cc': ['-Wunused-private-field'], + 'm2/gm2-compiler-boot': ['-Wunused-'], + # Rust peopel promised to clean these warnings too + 'rust/': ['-Wunused-private-field'], + 'libiberty/sha1.c': ['-Wc23-extensions'], + 'avr-mmcu.texi': [''], + 'gfortran.texi': [''], + 'install.texi': [''], + 'libgccjit.texi': [''], + 'libtool': [''] } for name, ignore in ignores.items(): diff --git a/contrib/gen_autofdo_event.py b/contrib/gen_autofdo_event.py index 4364e5c..b1d373f 100755 --- a/contrib/gen_autofdo_event.py +++ b/contrib/gen_autofdo_event.py @@ -138,8 +138,16 @@ if [ "$1" = "--all" ] ; then shift fi -if ! grep -q Intel /proc/cpuinfo ; then - echo >&2 "Only Intel CPUs supported" +if grep -q AuthenticAMD /proc/cpuinfo ; then + vendor=AMD + if ! grep -q " brs" /proc/cpuinfo && ! grep -q amd_lbr_v2 /proc/cpuinfo ; then + echo >&2 "AMD CPU with brs (Zen 3) or amd_lbr_v2 (Zen 4+) feature is required" + exit 1 + fi +elif grep -q Intel /proc/cpuinfo ; then + vendor=Intel +else + echo >&2 "Only AMD and Intel CPUs supported" exit 1 fi @@ -147,7 +155,7 @@ if grep -q hypervisor /proc/cpuinfo ; then echo >&2 "Warning: branch profiling may not be functional in VMs" fi -case `grep -E -q "^cpu family\s*: 6" /proc/cpuinfo && +case `test $vendor = Intel && grep -E -q "^cpu family\s*: 6" /proc/cpuinfo && grep -E "^model\s*:" /proc/cpuinfo | head -n1` in''') for event, mod in eventmap.items(): for m in mod[:-1]: @@ -156,8 +164,13 @@ case `grep -E -q "^cpu family\s*: 6" /proc/cpuinfo && print(r'''*) if perf list br_inst_retired | grep -q br_inst_retired.near_taken ; then E=br_inst_retired.near_taken:p + elif perf list ex_ret_brn_tkn | grep -q ex_ret_brn_tkn ; then + E=ex_ret_brn_tkn:P$FLAGS + elif $vendor = Intel ; then +echo >&2 "Unknown Intel CPU. Run contrib/gen_autofdo_event.py --all --script to update script." + exit 1 else -echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script." +echo >&2 "AMD CPU without support for ex_ret_brn_tkn event" exit 1 fi ;;''') print(r"esac") diff --git a/contrib/mklog.py b/contrib/mklog.py index dcf7dde..b841ef0 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -360,7 +360,7 @@ def skip_line_in_changelog(line): return FIRST_LINE_OF_END_RE.match(line) is None -if __name__ == '__main__': +def main(): extra_args = os.getenv('GCC_MKLOG_ARGS') if extra_args: sys.argv += json.loads(extra_args) @@ -389,6 +389,7 @@ if __name__ == '__main__': if args.input == '-': args.input = None if args.directory: + global root root = args.directory data = open(args.input, newline='\n') if args.input else sys.stdin @@ -447,3 +448,6 @@ if __name__ == '__main__': f.write('\n'.join(end)) else: print(output, end='') + +if __name__ == '__main__': + main() diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg index 1b87877..75d1025 100755 --- a/contrib/prepare-commit-msg +++ b/contrib/prepare-commit-msg @@ -78,4 +78,4 @@ else tee="cat" fi -git $cmd | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE" +git $cmd --default-prefix | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE" |