From patchwork Mon Feb 5 17:54:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 126919 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2181138ljc; Mon, 5 Feb 2018 09:54:36 -0800 (PST) X-Google-Smtp-Source: AH8x224rJ510ogOkEBeBkpTJ5FdCAyQOJOPpwoZJ3NLWdimzWLFX3Wz+5PAQ/ZxKiP5ei/y6DHC/ X-Received: by 2002:a17:902:8d97:: with SMTP id v23-v6mr39539256plo.248.1517853276521; Mon, 05 Feb 2018 09:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517853276; cv=none; d=google.com; s=arc-20160816; b=AcMRIZvdL8A509KUkEq0MlWMSzMY6IE2HFjgcVweMm4BDIOQeGAjDRJjtxaMx5W1tP 5P0PSvMOvcr1wIFA8TeEiCGFYNgJtM4fCv4uUwnUzgIGNNvCuOJdN7QsOqvwSX0mZJDU +iK9E5AD26qKHRXE/8Y5V6dBLrI3JMO+lHtgdfzzu8EEXtaESq+ZCqjEbJ04WKcLB0/d 5450KcUvHqsNMvXdT9LXUr7s7/0B8mFmzF3UeVxdQOkThphkD/9E3k8bVZB3n9FCQ0zE qXuRP7ImKxHruOll3xMpBf9lQsPj3dcDJDJrkwFdXF2cUHVlUaM+08X6WzB3yKnX/rsH WXnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:user-agent:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=xnDf5o5YX9CvhPbFcgCXiPtJiIyJnz51qIzjpGW6Jtc=; b=uxEqRVG/p5lqsNyNA+ngcrGFPKNHc+EyaRt824yx32KuhM8guUqfzoqYSmTYX6PNkq IwcHl+ioMR2Z7pjE0ndtTVDFurAPXl/Yhw/pJJWUp2s02l6+rfeAqQC+uX5+XdRAf4uQ tAZELspDFKEMqt7fVKfCpq96yXz8K4IEDn/LKcIkMlDcHEYCMeC5ZFQ/MUM588ByOCBz M5zhBMUs9Qn019vDKtP3K5ba7ibH02b4NnAF+T4h0eHItNl+JZveoXz0nUBSjq9i+VD/ 6L5yBwTfZOXfy+zRI5UugoGF9Rqt1w3b3RHU2GPesVWlYPaA/OcOnTEHR8cNeXEsoSAP sdoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xYX7ZawL; spf=pass (google.com: domain of gcc-patches-return-472617-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-472617-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g4-v6si7219291plp.818.2018.02.05.09.54.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 09:54:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-472617-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xYX7ZawL; spf=pass (google.com: domain of gcc-patches-return-472617-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-472617-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=CzfIB8pBDouTcxMjswDBfh3t6VVJLJ29QX1rHFf1/9rliF2aBvKCk 0nvGqafwyL0pkJq4qqGl2xjCeCl7JvFhqcc+sYilfW12d+wRtyVh7MwjeGStOGps nKc7cRIJLcMWVWAr2XzUUGzkf6OLPzic8gzkWiCgOTaJnCRveSlKDo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=2gKIxPs0Pvuur5R/89tufKW9OB8=; b=xYX7ZawLMTmgOlibqpuP 5kMyDbf+F7Vd/VRbhrrwE9iBawAXCZNsBFaiFMCkTok9Vmq5uYt2INYo4HrFqyGb vkaLAilipMWa+LcBdjOQZEc+3pEEiRNGm4AdGkz0vSYbxfGPPjE3uPekEh2buqhK q3DyBD5FXl/lUtHLWBnP/Po= Received: (qmail 10488 invoked by alias); 5 Feb 2018 17:54:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 10469 invoked by uid 89); 5 Feb 2018 17:54:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=84, Hx-languages-length:4593, 58111, filtered X-HELO: mail-wr0-f179.google.com Received: from mail-wr0-f179.google.com (HELO mail-wr0-f179.google.com) (209.85.128.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Feb 2018 17:54:21 +0000 Received: by mail-wr0-f179.google.com with SMTP id v31so30537647wrc.11 for ; Mon, 05 Feb 2018 09:54:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:user-agent:date :message-id:mime-version; bh=xnDf5o5YX9CvhPbFcgCXiPtJiIyJnz51qIzjpGW6Jtc=; b=lMxHF+bHj1/7lg8pPYdDTZHf/ihTgyAczIj2guXMCgVN9UxyTW16uHWpYbJshdQOjr 4QFRWC4bH+KE2ZoAWDAFjYbclwqac6Y0cqMxKPRjIAvK1cFIkmcofVGO/n0CtmezcrHc XHeNQv7/+w53Oc+No0CNlunhhsjnvWZoFIC+POr5N9R/pTqCrZieReDjfrHJdAmPcWjP I6F9pv9ARRnf30yDX/+chlDRNscOvCjXsOo3IfIH85uc3Wt/PQI/Zr1MJmLZe5NAhLQ/ NNaJjFcXFr9F1Y6X2WshhH/19spED6yZha3w4lQUaJqTBO4dB9k4RXKG4NltVikoT9/n DaVg== X-Gm-Message-State: AKwxyteDisYWIIi6lAALHdx1c38JL1TLbUSEHfHMSNUxQUQSvy1fCF1w pVTOpslkwabB1NARWQct3KuNnEAa83k= X-Received: by 10.223.153.240 with SMTP id y103mr27756268wrb.36.1517853259324; Mon, 05 Feb 2018 09:54:19 -0800 (PST) Received: from localhost (188.29.164.214.threembb.co.uk. [188.29.164.214]) by smtp.gmail.com with ESMTPSA id b72sm7933442wmf.2.2018.02.05.09.54.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Feb 2018 09:54:18 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [testsuite] Make lto.exp work with Tcl 8.4 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Date: Mon, 05 Feb 2018 17:54:16 +0000 Message-ID: <87r2pz1fw7.fsf@linaro.org> MIME-Version: 1.0 "dict" was added in Tcl 8.5, but until a couple of weeks ago the testsuite has worked with 8.4. This patch uses arrays instead, like we do for the caching in target-supports.exp. It is a bit uglier than using dicts was, but hopefully not too bad... Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2018-02-05 Richard Sandiford gcc/testsuite/ * lib/lto.exp (lto_handle_diagnostics): Remove messages_by_file argument and use dg-messages-by-file instead. Expect it to be an array rather than a dict. (lto-link-and-maybe-run): Remove messages_by_file argument and use an upvar for dg-messages-by-file. Update call to lto_handle_diagnostics. (lt-get-options): Treat dg-messages-by-file as an array rather than a dict. (lto-get-options-main): Likewise. Set the entry rather than appending. (lto-execute): Treat dg-messages-by-file as an array rather than a dict. Update call to lto-link-and-maybe-run. Index: gcc/testsuite/lib/lto.exp =================================================================== --- gcc/testsuite/lib/lto.exp 2018-01-19 11:57:10.397017291 +0000 +++ gcc/testsuite/lib/lto.exp 2018-02-05 17:51:17.386215067 +0000 @@ -111,18 +111,22 @@ proc lto_handle_diagnostics_for_file { n # the expected diagnostics within TEXT, issuing PASS/FAIL results. # Return TEXT, stripped of any diagnostics that were handled. # -# MESSAGES_BY_FILE is a dict; the keys are source files (with paths) -# the values are lists of expected messages, akin to DejaGnu's "dg-messages" -# variable. # TEXT is the textual output from the LTO link. -proc lto_handle_diagnostics { messages_by_file text } { +proc lto_handle_diagnostics { text } { global testcase + upvar dg-messages-by-file messages_by_file + verbose "lto_handle_diagnostics: entry: $text" 2 - verbose " messages_by_file $messages_by_file" 3 - dict for {src dg-messages} $messages_by_file { + if { ![array exists messages_by_file] } { + error "lto_handle_diagnostics: messages_by_file not defined" + } + + foreach src [lsort [array names messages_by_file]] { + set dg-messages $messages_by_file($src) + verbose " messages for $src: ${dg-messages}" 3 set text [lto_handle_diagnostics_for_file $testcase $src \ ${dg-messages} $text] } @@ -294,16 +298,15 @@ proc lto-obj { source dest optall optfil # OPTALL is a list of compiler and linker options to use for all tests # OPTFILE is a list of compiler and linker options to use for this test # OPTSTR is the list of options to list in messages -# MESSAGES_BY_FILE is a dict of (src, dg-messages) -proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr \ - messages_by_file } { +proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr } { global testcase global tool global compile_type global board_info + upvar dg-messages-by-file dg-messages-by-file + verbose "lto-link-and-maybe-run" 2 - verbose " messages_by_file $messages_by_file" 3 # Check that all of the objects were built successfully. foreach obj [split $objlist] { @@ -342,7 +345,7 @@ proc lto-link-and-maybe-run { testname o } # Check for diagnostics specified by directives - set comp_output [lto_handle_diagnostics $messages_by_file $comp_output] + set comp_output [lto_handle_diagnostics $comp_output] # Prune unimportant visibility warnings before checking output. set comp_output [lto_prune_warns $comp_output] @@ -527,7 +530,7 @@ proc lto-get-options-main { src } { } verbose "dg-messages: ${dg-messages}" 3 - dict append dg-messages-by-file $src ${dg-messages} + set dg-messages-by-file($src) ${dg-messages} # Return flags to use for compiling the primary source file and for # linking. @@ -578,7 +581,11 @@ proc lto-get-options { src } { } verbose "dg-messages: ${dg-messages}" 3 - dict append dg-messages-by-file $src ${dg-messages} + if { [info exists dg-messages-by-file($src)] } { + append dg-messages-by-file($src) ${dg-messages} + } else { + set dg-messages-by-file($src) ${dg-messages} + } return ${dg-extra-tool-flags} } @@ -609,7 +616,7 @@ proc lto-execute { src1 sid } { verbose "lto-execute: $src1" 1 set compile_type "run" set dg-do-what [list ${dg-do-what-default} "" P] - set dg-messages-by-file [dict create] + array set dg-messages-by-file [list] set extra_flags(0) [lto-get-options-main $src1] set compile_xfail(0) "" @@ -733,7 +740,7 @@ proc lto-execute { src1 sid } { lto-link-and-maybe-run \ "[lindex $obj_list 0]-[lindex $obj_list end]" \ $obj_list $execname $filtered ${dg-extra-ld-options} \ - $filtered ${dg-messages-by-file} + $filtered }