From patchwork Thu Mar 21 15:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47293 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp633925pzb; Thu, 21 Mar 2024 08:42:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWlosUgpdAkXiZwQB0f1XRK/vwkhQqPh/wa96qWC4aPNumQGNnpSM70mRlaa+bo9T6Xo+Cs4FGkTWmW1TgSKQPKjVw9fxqEjrwJ6Q== X-Google-Smtp-Source: AGHT+IHXjOXcbnQwuPlbecArW/BxT5Bq7kwRzDdhYQ2p6AUslS44WZ6nrDbZkg5N7Y7Skeg5h82t X-Received: by 2002:a05:6402:f12:b0:568:c2e5:ae9a with SMTP id i18-20020a0564020f1200b00568c2e5ae9amr10298188eda.5.1711035737466; Thu, 21 Mar 2024 08:42:17 -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 a14-20020a50c30e000000b0056bda36fa61si5200edb.483.2024.03.21.08.42.03; Thu, 21 Mar 2024 08:42:17 -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=KxPPcqOB; 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 D522E68D55E; Thu, 21 Mar 2024 17:41:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2022.outbound.protection.outlook.com [40.92.58.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E0F868D521 for ; Thu, 21 Mar 2024 17:41:53 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlMgAdWkD58/PdtCuKKZ9dSbGBaEJY+P6XlNeFWCjvVlvGP7JuqbvJLQrAHOPVn/lQJRadCNExC568RBoUfXwnMBnJ/4PjavKHGVvBXht8fhoewvOLbj+uasHoNxm14f8rBXTZmvtt5Jw4oJl02nBxJSVdgbiQbbX9PzKHEGB/op95Lj56gqh3t8Q2koO/CTswuSxmc2hq+Lfy5qCrgSEl6S1qi8TD+3ay2MXxQgz6Qr7NfsJlhxUbv1hFJmTu4CvfQWyhDhkPcZSRZzo/xo+Ff1USUE7HB9iXuM28T4t4h0MZ7idlv9bV16xNBvmrhs/a3KHqzzPB8hVei/EFSgVQ== 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=LU/df48IcYPciDCc/FKeStRisAjddzbvtKxV9th8r24=; b=hp8qGodI1VoP10RONMD8ey8x+skKEGxWwO3taBOvsnoYmJvebz87zEE+nLQhqckH7jqftnPG33R1/7cV3J55aHzicg6uEBd+yecLHH731hZWmq9vBG72K/j4rAxY2hqXzQbvjUfI+9vm43peJnur1wOhxrmhYQanYlAsPd1iOXY1wvK77xfV8uSZoLFAvS8RGKCsoPh8I4N9VL0Bm9xEX87MdtClF+N7fYKZVkib+y1H7VheqNchAc237KrehzSQBX9+oPTnMy3/sZiKE3twCm2MLL0aT5IJ8/w/BEsnA3GEb+1LWkUKIoYEMkfpeCGxnmCoG+M+XZDW2U7nTUgDWA== 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=LU/df48IcYPciDCc/FKeStRisAjddzbvtKxV9th8r24=; b=KxPPcqOBgb5gT9OvoE3a/YF1Pw/PDosuvToKiRNWK8Sjp0hNMGrNjhl9y6eWESHTq++8Wlmpb7c1F47IpHVf5gZ0HFG4C5p8OK3QgmFRNUmrrRq8pOS9AWFQok4iPGUE5o1ulrwz2EI0WKGkBOaoZmT95l7E/aRSFyzFDNTGfq8BQarTXJ0VFsZwmKVRrDFX/IrnSWXHWAM8ZUVFnk4yPr7sIhgTpJx+fqj/U3Cnh8immD3PHEze3b/CJcvFpagVyOMnjEnwnEgiNdep++aWYZGMr+bI4DVabrZuSXh8qohrBBHcQvlkvbJ8Ddn4a7P9Gt/bzr7VmbOLWw5h+nWI3g== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by PAXP250MB0568.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:282::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.31; Thu, 21 Mar 2024 15:41:51 +0000 Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf]) by DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf%3]) with mapi id 15.20.7362.035; Thu, 21 Mar 2024 15:41:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 21 Mar 2024 16:41:44 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [ubAWgGPieWmN7bPa7RY76kCoip8VHg/8gigv+xokjlk=] X-ClientProxiedBy: ZR2P278CA0070.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:52::13) To DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) X-Microsoft-Original-Message-ID: <20240321154144.562476-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|PAXP250MB0568:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e2cb071-7a4f-45be-da6e-08dc49bd6d71 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2qtjk7reRkGpNioWhg9qnxXKX0AFue1xUMD0LB/8GSW/8BmmUmCFh+X/3SFMt3s+5fW+FBjuU/elXhUkmx9gZvoThWLkOYx+IK4BzBNHAul5ps5auXGSotM3j3gb49dHFJQWQ8bI8VbDGjjtjN+MHSLo/dFWZmq23p66I6eCoNGJrNu0ntJFC5KS3ITGWkkgtNfI64XdD6YK0p3+oaqidqHrNNqq2RiS9nGOliLgwANFt5k7Ylkd0hvGWeBCU2xtUOTkGw1N3481Y6sniLBsDorKcss61kH/pA+EcXbikWN2GVzr7J+1yn6MfomIx2a6kudRv3wq/5uueU3tGwGoTssFR12FgX9+59dVD68RlZSRf2yACBNYkXdEjSr8HECQnV8oXt2lJcebJ0KXcuU5+ge7q1Zy6WewB9gV/e86hPdkd3Nmdw4PqJUQM3CSm5S5iTH8y9HyM+hHLP1CqujGLVApGjrSTRs0EoyPc3n5znepwehAl4daXSfv+NQCQ5JSwwQeB6ESlo2SAYuAGSVPVgUJSE/+JKOYOva+6FAvbkrt4EneSzaqmOLFjjg381KNOxo0q8rKEsmtQBUCo/+sfRZT2OLC5wKlZoJ9KjQenZwjyu0cWys2prVUzlscATBYOx1aMWqNkh2ji1P0bsMgP5QTWpferS7Q2/34vZk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gNrCVzmny5YNdD5WRQpLVqLgLbAVHT7z3DKmoWgKbxbILiRMEtgohX4PdA3s+m97w6flm33vzsrgEUh7ZyO/0FqBl1AoqLdssDw++uiLTpllMnEsoIov+ypyUj6zeQUnZD0cVfPvBMD7cfgMy4eNbI4eECW9TbSXEv6/TMcf0W3+MIcbKPRLveaFgZgh8CzF7jAGVscFuE8MSK0JzdXX7FOhDaHNf2gbBQ3TgOjvxkec85XC4glfKEIaK4BpVeBhUr0pwmprsVTJM65O3HWWsNUi6YxUyLvqfYY9vmylTQNQW1Ag7Rw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e2cb071-7a4f-45be-da6e-08dc49bd6d71 X-MS-Exchange-CrossTenant-AuthSource: DU0P250MB0747.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 15:41:51.5570 (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: PAXP250MB0568 Subject: [FFmpeg-devel] [PATCH] configure: Explicitly check for 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: wxvcEvWCNs8B C11 provides static assertions via _Static_assert and provides static_assert as a convenience define for this in assert.h. MSVC 19.27 declares support C11, but does not support _Static_assert, but somehow supports static_assert. That's therefore what we use. But apparently there are some old GCC toolchains where _Static_assert is supported, but assert.h does not provide the fallback define. Some fate boxes are affected by this [1]. This commit therefore checks whether static_assert works with assert.h included; if not, it checks whether using -Dstatic_assert=_Static_assert fixes it. Otherwise it errors out. [1]: https://fate.ffmpeg.org/report.cgi?time=20240321123620&slot=sh4-debian-qemu-gcc-4.7 Signed-off-by: Andreas Rheinhardt --- configure | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/configure b/configure index 6d7b33b0ff..61075608ea 100755 --- a/configure +++ b/configure @@ -5589,6 +5589,21 @@ 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"; } +for static_assert in "" _Static_assert; do + test_cc ${static_assert:+-Dstatic_assert=$static_assert} < +#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 +done || die "Compiler lacks support for C11 static_assert" + check_cppflags -D_FILE_OFFSET_BITS=64 check_cppflags -D_LARGEFILE_SOURCE