From patchwork Sat Mar 23 14:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47373 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c889:b0:1a3:b6bb:3029 with SMTP id hb9csp255869pzb; Sat, 23 Mar 2024 07:52:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURXppmS1pRId7UzQyT11OhBipvpK4d03maKjnW2GyKJfw0AxIPtltu1rc/SuJMtX7+UE2QLCfnFKvpAknvWSdr7esIErjL9ccuJg== X-Google-Smtp-Source: AGHT+IHfvkD5h4V0qVUBdKTu/hoQMEP2ExJ3Wkme1Qs8HiA/LA/DQtMhv4EzmvlijTIl+XTVfYHY X-Received: by 2002:a50:d55e:0:b0:56b:cecb:a4c8 with SMTP id f30-20020a50d55e000000b0056bcecba4c8mr2050732edj.39.1711205529431; Sat, 23 Mar 2024 07:52:09 -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 u5-20020a509505000000b0056b83f04362si873214eda.570.2024.03.23.07.52.08; Sat, 23 Mar 2024 07:52:09 -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=LMACrxXH; 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 3BEB268D29A; Sat, 23 Mar 2024 16:52:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02olkn2010.outbound.protection.outlook.com [40.92.50.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C02FC68D2AE for ; Sat, 23 Mar 2024 16:51:57 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WkcqX9ZpxL5xORMl7Fhgz+edEJBwSobI9Y95gYMtEQQ+Ath+hDVzxRspcQMKLxEksU98s652CkTGx84tFS80jKP4gEfS+qqgjFjH9mnC2f6l0Wzyv0XywCz+ycfiHPE4QkQHb1gRtI4ZJiUcojGgOfF9LryUD3u5Q1Xo405ekg+Pc4hsveJaqL353SI+pCIaUiUf8wgXdyamTOJtwVurvxes+DvOMnO4/5q5LHV7zzyd/J7HeLsmGon1OumcPpt7XZnq38T5+498L9VR+gVD9s5WGofCTWcH0KavSvbcCBLoP7cf4e+qUeAyIKc+1+xlUktYvdOh7Inzs1Hr8TO4tQ== 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=cuGSV4NwWgJxHzcr22nhDAjkhqLz0mHnHuDW4oX8+po=; b=FXWWeI/U+37swTAagnUSjsmydrMMcUqnBFEvE2Esohx+L8hK08ANKEw/qYZEw2BPUZJPJoeJZjTEJG/RUbYykGY0H+JKJLcfIPoe7TC62//cBJTA8wYO+1/JSq+akdcb/6LO53I2ktIw1NesSzjlCPu6jaoXcvSfLmv69LGlSWhp3NsPml1noi1UiX5tMNDjv35hL946lx5E3mhxtQiPDLgVGZs82y9xSSHIZYHXKlyLrcJU34wrVXAc3auiJCrqb4oS59f/j/mLtG34L9ffuLVqQ71V/ueSpUGRyXz6YCllO4QMe5EDy4MhUpBlPizwpxE0UjOtyZ5eT1LLmHfAQQ== 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=cuGSV4NwWgJxHzcr22nhDAjkhqLz0mHnHuDW4oX8+po=; b=LMACrxXH5C6qqay3NuC+5zBt81kMWKEVeE8OMpjzH87iZHv0e0PB1AEr5n7t6mTAW730apIRcss7Tqg6fsNSjbNiF2DH2B6J5j5SXKxf5Fkvui2LDUt8KmNdaqIAsFVB8ovDObUHRvO88Dr3uqTRwcsWDAxjznv1nPn+2VVtvbfTDK23J7DAVcByB6BNHchuRp10UVdF9phaGTdhecEuSyP0gVeDMSG7uBxFXO54MGbRlU84hiZqNy6MG/Qt9ceJMYnuzira0xi41pbieAt5n1p8XExwelIF+RmWENqpfB06MbRroKkLR8HtLn0H2HQPtiGYXw4Rah0lO9gR8LLD/Q== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0318.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.28; Sat, 23 Mar 2024 14:51:55 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb%3]) with mapi id 15.20.7409.023; Sat, 23 Mar 2024 14:51:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Mar 2024 15:51:48 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [H19T3L/oyySgnIuKaoU1I5L6khjjcrUwQdvr3GELtkk=] X-ClientProxiedBy: FR0P281CA0163.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b3::17) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240323145148.1598789-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0318:EE_ X-MS-Office365-Filtering-Correlation-Id: 5aa197b9-cf2c-41e7-e493-08dc4b48c85c X-MS-Exchange-SLBlob-MailProps: cn60g5V53KO04gLNq/Jyx3xHLiXBo1M79Nnv0iFQeTd19DqgmEilDo96gTT9b9D3+OVm9tBYjN5VbYQn7M9kd5r9KKKtXj+iKuWfh2gS1SFeDreM5fzpWk+et1XUPqXVlAoaH5YCyI3lixYP4NsZHnwRjsPEvqPngNOnrknhmZqvTzV9XBIDvEAanC5oc/1m3yaN0jNUEQELvGCWXsf3cicPK77QtZMgSNcAq++7zfbJeMbV3blP63mVji6nS732OFQilS3YyQvvPZ9qfl5BCEjSvSos+CC+ZZm2/J6HEU5rcoVhwYPHyCF216nSzBdrkphi0eT5pC9Vdmv8DFHUOewmepH/94NS5Jm5d/UsKlDA7kMtvHFYlb9RbQQvlpnh1yIR1qcwTnuopIf4zcPvORZ3xvztogDyuw9pEwPVeKRJFzPbCaos1mY6ilbqnzpGpQmME0cU9GowLilSu3T+1dEjVrzcRquIB77b1Iko6hw2cZaeBELvp1TrsJl2i/gGIVb5WFbfS8TLvWrIw0qLcMFSghNZOx8peAEyXY2eUDlk7kIbc3pGhu6lD+w2Ifa4cyJchB98CgkOSpo+W9ecH2qmJX5qlEjXYBxzo+JuWX1+CscOZ+HZpDGjrjkmQLbp4jbgpos7soLC7F1M79rOsY/e2PZaoAegvsSLrAetZsQpRolo1JUzGsNJFO2vIh/JcxNf2XIXmOXgJcszqJNGahqxU9e9ea26VaSCAMpQ8Fy/JEjsmdw7w2zHczJSpRHpPjazMZDXzQveXGzFInFjgcQXTtYChzYprT97YUGe/dQX2nnX2f6NFkEn+gz4JkAKKE3WVN+NXR4gaccgVQ1GZZNvTGRPfCLiNotVVLJS15EJmgyGvFtCSw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ux0fFLSYqiABpRgJfASF8sknzF4wXsX0Er1dyiRVRHuQ1Iif+LtGMhLtnJ786anutxoTnHasKOMiOYHrF6Ho4kN9IcsBWIsnve693LmW1sne5di1q6u9tJ96X33L2OzNK/k5jV5OejH5rwL2hAN38gwkTERseX9bygdwx4lEUkBsA7NL/o61godgtaURBHYOwPqTN6CG2XCw8zUMxhagbz36N+IAwWeoC9B2j6ivUc7UZGCnZzC+/3J216vzov3SyqLbgR2dZgFYGI0p9gJlItQaD8C3Qp3AyTrxysQM2iXEiIC1Ri5HJjlqmmx9fm1e5hK+/zExs+asnGkZ639pffJNfgxq0zbb0rVEaJY+zXVlkiPpEh7S4J8NqeYqpCSWTGLrDYLkd1VC8kcYfdt/tp1bRwKXYwLNK0ylcIJJEZjhJiNMZdtFrf3m5hHVvdrsyPYff3+agDzBEUlfurklzrU4E7Z42UvPbYxV374cY1t7i+xMNRNFzqiB+mSrYDThzcCmYRXZG5RbV6FMQdjcwXOEz1KopDo662ZWMSEd6807HQfMIMyO9QB4sPsyjjnzOKbPAGJdE9udY7y4HqNunaCPEMLIaJ9iOmbn+iC62CmURT5mUI+JUGbvNKfblypGCxCYgk+Fr/YNOezbfk1s87Ciwr/ZNpIkisz/DtSUiC5Nn9ze70xEAh2onLyUkB6X X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XydEgbDhBSKrPQ2pzAtxFPLkhoIgtlZ3ZXcVbN+aDPHIRg7B3eeLn05VVrqzg93NY35SVocKygQnc6LE43bKI0AQpS8lZoNBjH/JucfiVxKNep0lDq4f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BTXN567OHLwgCosu79iErEMk9z5F9vRXVZmaxNF7t0nqyjarudMfMnRJATuDObTEIOmyELn6nxoPewYtMtdJ3QY1JvsDYYhXR8Opn2DACLKY2uJXviVg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5aa197b9-cf2c-41e7-e493-08dc4b48c85c X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2024 14:51:55.2840 (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: DU2P250MB0318 Subject: [FFmpeg-devel] [PATCH] all: Don't use ATOMIC_VAR_INIT 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: pwP4qimMLHXP C11 required to use ATOMIC_VAR_INIT to statically initialize atomic objects with static storage duration. Yet this macro was unsuitable for initializing structures [1] and was actually unneeded for all known implementations (this includes our compatibility fallback implementations which simply wrap the value in parentheses: #define ATOMIC_VAR_INIT(value) (value)). Therefore C17 deprecated the macro and C23 actually removed it [2]. Since commit 5ff0eb34d2b1089d3dd9f27fdb51520001709138 we default to C17 if the compiler supports it; Clang warns about ATOMIC_VAR_INIT in this mode. Given that no implementation ever needed this macro, this commit stops using it to avoid this warning. [1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_485 [2]: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT Signed-off-by: Andreas Rheinhardt --- configure | 4 ++-- fftools/ffmpeg.c | 2 +- libavformat/allformats.c | 4 ++-- libavutil/cpu.c | 6 +++--- libavutil/mem.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure b/configure index b9fa8652c4..e577dcc677 100755 --- a/configure +++ b/configure @@ -6610,8 +6610,8 @@ check_headers asm/types.h # some configurations also require linking to libatomic, so try # both with -latomic and without for LATOMIC in "-latomic" ""; do - check_builtin stdatomic stdatomic.h \ - "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \ + check_builtin stdatomic stdatomic.h \ + "atomic_int foo, bar = -1; atomic_store(&foo, 0); foo += bar" \ $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break done diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d4e5f978f1..5e00d5b645 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -157,7 +157,7 @@ void term_exit(void) static volatile int received_sigterm = 0; static volatile int received_nb_signals = 0; -static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0); +static atomic_int transcode_init_done = 0; static volatile int ffmpeg_exited = 0; static int64_t copy_ts_first_pts = AV_NOPTS_VALUE; diff --git a/libavformat/allformats.c b/libavformat/allformats.c index e15d0fa6d7..9df42bb87a 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -576,8 +576,8 @@ extern const FFInputFormat ff_vapoursynth_demuxer; #include "libavformat/muxer_list.c" #include "libavformat/demuxer_list.c" -static atomic_uintptr_t indev_list_intptr = ATOMIC_VAR_INIT(0); -static atomic_uintptr_t outdev_list_intptr = ATOMIC_VAR_INIT(0); +static atomic_uintptr_t indev_list_intptr = 0; +static atomic_uintptr_t outdev_list_intptr = 0; const AVOutputFormat *av_muxer_iterate(void **opaque) { diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 48d195168c..d4f947360a 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -49,8 +49,8 @@ #include #endif -static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1); -static atomic_int cpu_count = ATOMIC_VAR_INIT(-1); +static atomic_int cpu_flags = -1; +static atomic_int cpu_count = -1; static int get_cpu_flags(void) { @@ -208,7 +208,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) int av_cpu_count(void) { - static atomic_int printed = ATOMIC_VAR_INIT(0); + static atomic_int printed = 0; int nb_cpus = 1; int count = 0; diff --git a/libavutil/mem.c b/libavutil/mem.c index 62163b4cb3..02d4cb791f 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -69,7 +69,7 @@ void free(void *ptr); * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags. * Note that this will cost performance. */ -static atomic_size_t max_alloc_size = ATOMIC_VAR_INIT(INT_MAX); +static atomic_size_t max_alloc_size = INT_MAX; void av_max_alloc(size_t max){ atomic_store_explicit(&max_alloc_size, max, memory_order_relaxed);