From patchwork Fri Aug 4 11:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 43118 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b914:b0:130:ccc6:6c4b with SMTP id fe20csp534640pzb; Fri, 4 Aug 2023 04:29:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG56uiNfvg+bUZ3yOQnG/NFmLTU3XSoaPYHVRoiyJQxA2CNeLqH3wwm2R8dmZ93KvqBWYG6 X-Received: by 2002:a17:907:a04a:b0:993:f12a:39ce with SMTP id gz10-20020a170907a04a00b00993f12a39cemr1261799ejc.15.1691148551162; Fri, 04 Aug 2023 04:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691148551; cv=none; d=google.com; s=arc-20160816; b=QmadfzcwQoz9b9aOs7PDzlWrPorfwxDzexLSk4Uo1hYt+gTdBkVYecXMfkMw2suroN u0svhSaDozH5Sud1fPyxpbmrLSAqKa2WKxCUWJc/8upgVIwSwwcoZ5Mxgp5eMEToYq5G Qtbpg+Bl5G3er7sYDcG+W8dmq08yQ2/390cPkiNjW25TrtZ1skYnHrDXGhYeDNZWJilI /7G39UqKfobcQfbCJQvZbBkJ5QPtgxIAKkXm+Uk0SBV4LRR+hWahd0TACvJZ3H0aQTvp CTcYlS5qntcS3UadKUG4LjU5TMNA4s9JVXBP+hG/TEL+0Sne+P9stIR7vbKsPIvShdE9 A35w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=OpoDtpk9XfRlCEmlo3VlZ/fDRYq0iP1mZ+tsCCcMBWM=; fh=nsVKsSaZMdLznXlUv/EWC2FmpLC7hjoSIJBzkkMfbDw=; b=w3lddZ/pMNh1kMNt0JEtLcKW/znTsJxXSd5v4r3z5n9W6kC56sDHLwS+CVA1FO5/nL yfTu0Xdn5jVjsW2FrHDQIDsNt6CbVa9N+S0m3cDfrDOlzxtGxJTx58hs6qL3wTZKbhcT kYMnuwhQD66TvIhKfI11VtOuI6HJ9os02i9Q1QtShaPrUg4KgHwbrGjZMKtByKQIglf0 CgyPVsKbrHFzUok77KXplsQZCQWyFvM5C5nKMkUFKCbY0M9O4edMiocK6Oy6KHC4XQbl lfXd/euj0tAqwGC7WYW3AOZMlE72K+kWt0xhlHrvCBcrDX38t1L/JizTipUX3Mi9LWXY ffaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20221208.gappssmtp.com header.s=20221208 header.b=pTIg7wtw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m12-20020a1709061ecc00b00992feae3848si915587ejj.38.2023.08.04.04.29.10; Fri, 04 Aug 2023 04:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20221208.gappssmtp.com header.s=20221208 header.b=pTIg7wtw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3001B68C70A; Fri, 4 Aug 2023 14:29:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 91C5A68C06E for ; Fri, 4 Aug 2023 14:28:59 +0300 (EEST) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-4fe383c1a26so3463892e87.1 for ; Fri, 04 Aug 2023 04:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20221208.gappssmtp.com; s=20221208; t=1691148538; x=1691753338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q8mXD4h6yKPBEsMsi9LoksARZhaqF3aU/VA0XOREUc0=; b=pTIg7wtw5fq/sqmFF2TVGwZoVB7jShPSD5BI6jjeFoK49/70biX5S1y3saZnQNVwju jQDjweDOQuarwsMoHyF0RcfmSHs47a/HlJJV+qHvulFeA7IEFXxmDoda76Na6KO+l668 3VT1/nNBTxqI8JN1CXs4L7J1mQJr2yYUMDC9oEx5JQtx/soRkmjP4wOnEkw5l2JoJ5lz cRDM1iFKTISQtYwStrY4aePyx5Hi+vJYrKcBve2KdNpepJ8iHdjhDZ2tnbii15V/K15G ZMbezm8HWEQBp6SvWXI86KGmNQrT3QC431gRie9DjVwvUpHGlH9CoQf5IbOLRSLAKClc 1p6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691148538; x=1691753338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q8mXD4h6yKPBEsMsi9LoksARZhaqF3aU/VA0XOREUc0=; b=lc1AyDjqL5wRIX9TuDZKxj7melfyBJKQJyDciU9JtiDtlcIGXOZOs/7rEIztjsMMBk 1kH1c2gxGb3r73rraAVqXR1iQnmSiEPkp4D0oE5DHER/79QEJ/oXyLNHNqrpbuGEyc86 Q/QzesUL/6b0Rd0sPC/skDc0y9QPAjXGX/FmFoDqc1mcf9PKlFFT0EzEjEZkXxda7ARt UEQ71dAxvHKf5Eahz0fNhPaNwOlyZb+EFbgN1TfD6dQhdNWcZuEV6WlV+aHaxmF+bTaI 22prNC2popeC+hmnObj9/pHEV9zgfviDa+mlae4h6A5Y6FBC1ViAD1AQCv7jFxyG+8Hq g4BQ== X-Gm-Message-State: AOJu0YxdAjZDBrM2GpmWQOHytEpsDKRL77mHQjcj5ZUjzXY1cJ1kLBTB jViVn3gA7YmoNzBLWgwVN6AEbd4If1HDghEiUMO0AA== X-Received: by 2002:a05:6512:3495:b0:4f8:70d8:28f8 with SMTP id v21-20020a056512349500b004f870d828f8mr923738lfr.55.1691148538143; Fri, 04 Aug 2023 04:28:58 -0700 (PDT) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id q2-20020ac25282000000b004f864690901sm333189lfm.244.2023.08.04.04.28.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 04:28:57 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 4 Aug 2023 14:28:56 +0300 Message-Id: <20230804112856.3896010-1-martin@martin.st> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230802070206.28917-1-martin@martin.st> References: <20230802070206.28917-1-martin@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] intreadwrite: Indicate potential aliasing in AV_RN/AV_WN for Clang/MSVC mode X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PEJa4vSPL5jG Use the GCC specific codepath for Clang in MSVC mode too. This matches the condition used in a number of other places. MSVC doesn't have a way to signal potential aliasing, while GCC (and Clang) can use __attribute__((may_alias)) for this purpose. When building with Clang in MSVC mode, __GNUC__ isn't defined but _MSC_VER is as Clang primarily impersonates MSVC - but even then it does support the GCC style attributes. The GCC specific codepath uses av_alias, which expands to the may_alias attribute if supported. The MSVC specific codepath doesn't use av_alias so far (as MSVC doesn't support any corresponding attribute). This fixes a couple HEVC decoder tests when built with Clang 14 or newer in MSVC mode (with issues observed on all of x86_64, armv7 and aarch64). --- v2: Changed to just use the GCC specific codepath here, as suggested by Andreas on irc. Will push if there's no objections. --- libavutil/intreadwrite.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h index c4679fdba4..21df7887f3 100644 --- a/libavutil/intreadwrite.h +++ b/libavutil/intreadwrite.h @@ -213,7 +213,7 @@ typedef union { * by per-arch headers. */ -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;