From patchwork Fri Mar 22 21:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47337 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1014:b0:1a3:ac71:9534 with SMTP id nk20csp200080pzb; Fri, 22 Mar 2024 14:53:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrjCN5JBpkMjAs5o2rrveKfJj0g51hay+0DcqfnPMoP5XgLI/JTfUcQYcKvsb1Zj/ltrkp2BE0sRJZO/p/sGgVq5zVIMeVjnkCBQ== X-Google-Smtp-Source: AGHT+IGhYr4ErzH7kwcNFmgHzqyLIrL0ugsZispuEW5zwemedCQhydc25DuQbyqmAnoc9LprwIZf X-Received: by 2002:a17:906:a117:b0:a47:33aa:d85f with SMTP id t23-20020a170906a11700b00a4733aad85fmr665796ejy.11.1711144414910; Fri, 22 Mar 2024 14:53:34 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l22-20020a170906415600b00a473a24aa7fsi207447ejk.650.2024.03.22.14.53.16; Fri, 22 Mar 2024 14:53:34 -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=@outlook.com header.s=selector1 header.b=Aq2RSeLt; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F21C68D567; Fri, 22 Mar 2024 23:53:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04olkn2087.outbound.protection.outlook.com [40.92.75.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6D0C868D499 for ; Fri, 22 Mar 2024 23:53:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WFDhQdJCJyOP3X79urEMDjTwx5bI26jZINku+06f4Q5KFvdU3xpgtVSc2Z7QgrkGvUWvFK3fbe3cUNdx7U/kHcwqbPL/9gqpxbTzNWz86ae03bw0s44g3FvDyOmNyBRfI7s3fLWbWLi2P/3BgDmsY7K9I2VS77BmIQA1dtBQEfgJnu+ADlwYkWjXks6FOQ4ljwFRlUE4LHEBJSYBnwnIDyjFDeXYwH0FJCmppk1b7GL5jEdRqYUm4mdd9kBE2O4ypby6tzkNXEHVMIB0Qg6ZDCqcp4WdUM+zkz1MGmML13goBqapR3HOBMD84GUqMnCbM/v4YE0XZu7v2nEK5Uc3vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sy8MOcsxazxXKvqZ2mbwzpI+24gv7+Jwn4DifF5Ijmc=; b=k+EJ2El/AMCH6q8rvXM6qe/1AO3tGufl9MWBg4srLDwNbMVTSq1KZ5odxrocOd6D0d8tllaQu+NIRMEvnBfSAvfB2VJqgwaIcuji8sK6avDMNcPwLISW3B957Vs2SNLEIDTYWyz+Rc92kqwGAGTsM6QHOe0Kf6fgEEX9BCt88Te5eggjCvbURHjo6CEIu3tzV3DmoQq5v38NadyEOW8M3LSQnZNyooC1IRktBdTMwWVqf+x9+PElotRroUHbhEnYBwuHt7PoXd4vlDGxTWH8JMLnsPbta4Nd08ANYccdJcGUkw6jD7yw9XUcoThK2t1vW5Bp9KewlvSIEjQDPlLCuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sy8MOcsxazxXKvqZ2mbwzpI+24gv7+Jwn4DifF5Ijmc=; b=Aq2RSeLtBefLQeyOrJv5DoZ05Pw1whJJLaEhvgf0OhcSvsKCjWrcpOBt9xfdb914u4GWHQ8I39NJT9EN4+rMWXN6RmDrsp4T39y0VV20SUss8pVXtADXmEtK3d1rAFWInMsjnJzgcoIJcTgfpY7WsycMOPtvF5R536qQIDuETHwECiYCtfOM0oeYObKxUvTHEJqq08q54/Ps2Rc+vAo32xySMJWE95KAIQCiC8ngQxrVeXs378OkwI4zKIVVqG6dcIgT8Z8Ep67haE3bBQ6uBHLUogqRAL1Bu5CqJ4cEBCt450Uthw4mBs7v1Qgb36Og81iapbfm+4rPhJuPtL1hnQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0569.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:339::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Fri, 22 Mar 2024 21:53:04 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d%4]) with mapi id 15.20.7386.025; Fri, 22 Mar 2024 21:53:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Mar 2024 22:52:57 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [lBb+lQItbg25anwd3liXWFiGvlDnPe1Sp8HN0Lg0WXw=] X-ClientProxiedBy: ZRAP278CA0005.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::15) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240322215257.909650-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0569:EE_ X-MS-Office365-Filtering-Correlation-Id: b38ffaeb-4601-4ba4-a18a-08dc4aba73ae X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqkjmXb1vlddM5aSa/Epk3Ag9IWc7IiaMPf4wXe97mm9zCh+PQBO6W494RQWOFRfHuj0c8rd4MbRNkveQlH1K/gHsAieZI3InZQD0h7wOMSl8eUIlID8DV+KPr8QcLMTP/QiBoyxuhLE0DwlomttwSrX0Gd1Ag4bWWJzHiIUYS7oPNEjIfoFgmdbFeYoCRw+c6iJjzd6WbbvZ5HrreedxbMoOXg4kXGuuVxJ7/8n5IbhnSSaROMUTc/FXYS0mnFzDKf6DXc/lBfIcbWgQDRIMoLdMtywvkybFcL1Lhp/QcAAyHhrGZLDxMRWFhBueoYd4tcjxEGmMdUij6Za9vI6tNJv5jcjrzRTa6eapPAjIrQfgZ9BPNF6ELIcxJcYyjEtDjjY8BoUURwdVLIfeMk+jvY2bLuYXBMoIp6RXGvEVKkwT1Ba1+GuHET5euWhs6H0rvoCRJUksGZR4x7LfYy+q50iwuHNO40Cd1dmxtn8CtGe6HHp5ZQ2wGtM0AFDCi+C4SObOXsNwcX9PuKA6e2zSt0Fb15AnBJxTv7GV+PFDO283oA3QaXcd52UU0KtAQH/G+HDXLl3CPZKUol+6DlM9EWER/55kB4f55bEw8S4ggltXx8g8ntRf1bANQ4LtoPYltWQrQCm3NWqigy+1gleguno1mo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TAuai6+IsrcxYTNfNVbJgJd9N7R0W0xsikNTjJjb7TmUeM4fho7fjXyDQQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b38ffaeb-4601-4ba4-a18a-08dc4aba73ae X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 21:53:04.6901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P250MB0569 Subject: [FFmpeg-devel] [PATCH v3] configure: Explicitly check for static_assert, _Static_assert 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NwlEwHQZwe6a C11 provides static assertions via _Static_assert and provides static_assert as a convenience define for this in assert.h. Our codebase uses the latter, as _Static_assert has actually already been deprecated in C23. Not all toolchains that declare support for C11 actually support it; e.g. MSVC 19.27 does not support _Static_assert, but somehow supports static_assert. MSVC 19.27 admits to be a "preview implementation of the ISO C11 standard", so this is not surprising (MSVC 19.28 does not come with this caveat). Furthermore some FATE boxes [1] use old GCC toolchains (with only experimental support for C11) where _Static_assert is supported, but assert.h does not provide the fallback define. They are broken since the first usage of static_assert. This commit therefore checks whether static_assert and _Static_assert work with assert.h included; if not, configure errors out. This intentionally drops support for MSVC 19.27. Users like the old FATE boxes above can still add -Dstatic_assert=_Static_assert to cflags as a workaround if desired. [1]: https://fate.ffmpeg.org/report.cgi?time=20240321123620&slot=sh4-debian-qemu-gcc-4.7 Signed-off-by: Andreas Rheinhardt --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure b/configure index 343edb38ab..fc366549bc 100755 --- a/configure +++ b/configure @@ -5589,6 +5589,19 @@ check_cxxflags_cc -std=$stdcxx ctype.h "__cplusplus >= 201103L" || check_cflags_cc -std=$stdc ctype.h "__STDC_VERSION__ >= 201112L" || { check_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" && stdc="c11" || die "Compiler lacks C11 support"; } +test_cc < +#include +struct Foo { + int a; + void *ptr; +} obj; +static_assert(offsetof(struct Foo, a) == 0, + "First element of struct does not have offset 0"); +_Static_assert(offsetof(struct Foo, ptr) >= offsetof(struct Foo, a) + sizeof(obj.a), + "elements not properly ordered in struct"); +EOF + check_cppflags -D_FILE_OFFSET_BITS=64 check_cppflags -D_LARGEFILE_SOURCE