From patchwork Thu Mar 28 23:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47623 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1667794pzb; Thu, 28 Mar 2024 16:12:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUV8imXZaBXygYeV9mkuVaz/rzUg/VqSirsj1MFZqWuY4AyBzgjHbDaCA3XIlzj1j4OrZfmlLLac67cvtrJ8ydMFekWcewXuEF6Og== X-Google-Smtp-Source: AGHT+IEhVRdj/6dY3ELEAtO3Fon8UElAd71MX4UAOiDYaPmwPUoFfA80uCuyhkDumgaiRPrnltw/ X-Received: by 2002:a17:907:7883:b0:a46:8daa:436f with SMTP id ku3-20020a170907788300b00a468daa436fmr374139ejc.69.1711667549359; Thu, 28 Mar 2024 16:12:29 -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 s23-20020a170906355700b00a471122a534si1106614eja.811.2024.03.28.16.12.29; Thu, 28 Mar 2024 16:12:29 -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=EjbZMWpR; 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 6FD0968D756; Fri, 29 Mar 2024 01:11:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2063.outbound.protection.outlook.com [40.92.90.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C968768D751 for ; Fri, 29 Mar 2024 01:11:20 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R/XZwTYzp7qyGgwfMrWiJMZnG2gJwpZTqHV7vjFW8q3Oj1KrUfUemliiHseR8ZbnilmECW4LVAWocLd/VQkxEESJ6dXs3whNainMdFTNx7jzaJuQHcSx+qX6Tq9sNz34yzvg8i+9vign6Vcavo0UqqviNyIqJNMipErxX/mpB1c5m+yCyRvE/wNMr2Xtrn2LmESf260/9UrBpcnQaVWvXLk5Y0vIisB5bm851iTVkwRGvLWrbiiZDvbHc/j3GRWKuFEGRYdQpKRFLyIahge4mSp0g6ri2ErpaYVL2Gn19GVNoyoi0B0yAi3GFXt+TSeDuoMUJRn6qHjp5MZEaGm6HA== 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=ocuyZ/nGHBX12xr2PQA0FaIqhd8x3GGKX1lfL28LUcQ=; b=YckyAlZSwRbeV7BSXhiOoY+VEZEhpNfYxZdeu22RGAoiO/UbpX813BsyjvCi5bJsooMtSAUyuplSXxieUN/f+ZTAIoyXhOU8LFaPf1u7BGOReuKfhle7w21s5PxAu8DFIDxMpm2JhW/M9+UXgqcIvDttMdVNjM97G1KpxIB99QRgV+GveoNb7dufQx80ZnSXRQMFgIHRLmpt6Si0mHB5pmRPWYKwnIZbXhGV85FgKTtalNF0AAtD5jRUdLTG+2LAoUBQRHn0Ncd186OJDlMNFIttpnvZ9fWa3t9HtHtST0j9xxAIYBBpSU/s4jChsMNNsCX3X7LTTLeMWdZQP3wFwg== 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=ocuyZ/nGHBX12xr2PQA0FaIqhd8x3GGKX1lfL28LUcQ=; b=EjbZMWpRqlrIhFKmH44ypJY20XgAzoY2nVZNsC9FFmbIZJvqVF/UMOXTBE7SSQHT3+GbESefaemApHFERUD+/7mHfrr4tfr/4EM4ALAag50gFIKOEuu6d265OnMSEaru9xHr187IVcwAQHTauEizr7IyTRfciTb+4IKukofBUbG5BlxXQ4DUEgzDNjtg8TxL3sxrFGHAGNC3qx6eh/hXXXS7oUxbuGa69rWZAUkNse7NNGtBrrywKay/jKp4xPPPrFklBdpVMYkgllxIgQf6Akm+RdrVsyFtW9eTe+yjbDQFrv3H5H/PcmmnhW76ded9q6KtDKkZvWvF5DyNwqQFIA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AS1P250MB0553.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Thu, 28 Mar 2024 23:11:19 +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.039; Thu, 28 Mar 2024 23:11:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Mar 2024 00:10:40 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [lfDzfxEw5PlA3xs3Tl0O1xnlPstCHBK3GVyWnmeH4XQ=] X-ClientProxiedBy: ZR0P278CA0093.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::8) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240328231047.2202386-10-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS1P250MB0553:EE_ X-MS-Office365-Filtering-Correlation-Id: af40e4af-1fdd-41ea-31e7-08dc4f7c6039 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5pBwpiASsC6GSWan/JCJa9x7g82DU+bsab5U9hyZoF4/LFIiU2nGd2IcbIExNW9OIWM0ksFmi9h7c/158fGKIqZYRbc5qCIpY81w3D/947cDiebJ8sy1Fqr6/eMVW0RKKY0GE7lrQNJdmB5UpnvFW+ljZHyhqZJJU7wm7jF2bbovPyXfkQPKX/uQiIDoyZbqulpjaZYZv6afJoU2/Yu1+SEhu6NMc1ZDb4dmqRumVNd6BgdTYAtgR58zFvoq2Ao0fVR4pM6vHHeFFn55q5JUv8o+peymQHg1QpX21O4/Q6iIemRXQyuimdr+YfNRCjpBrLFXCOZKXjJx6+ayIGaPsuHKKDv8AWvI0ID9LgO0JJ6wYSXUSxJwqQYHM8eafCIjCspBRA4kgjgP9HYC0U6DQRojN3NKj82ipzghxJEt6f2BaRK6ZorTRRnc8lo/aRZN74/wXF8w4MMMRDoz6+NTq1TxFctXgr3lglOUWOIwsSAOF2fPG114NkHVJzWG3892tOGVQgNBiXcmsotBCCwnY6rPfcgUeE5LrEQW6nXyuF9GnxyBPOydaM6C0HYG8bq7woCFj9tx0Rm7PAlenwuDr2iLNSHCYkp0i+m6AacvyVaUqC8/NQKTacvGyVdGUsJj X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1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8AKpCzfiQwaLbcvXVEeDAP3CvMTnqzr0YRXtqvRzyJ+NUZWSsdncvJHfWfvpkDTgvinKB11cp1UT1Nn1FR9QMSmbxwzyeaXDrmXjo65UujpGEw4+rv4HEfAV57yoSuoa+SVXGBD5xdJSv0Oh7DTNAVe8E7sfucar9vkhHfbg4Af6vql4RN7NDhCcehOBGvGkjMyTAnHWw0MpoUWdI3TwFNhdseq+Z8pCPmjIKY1PKFakMGUfNZ0nADkG8IxG2GmOMvp+gvSH3LBEMw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: af40e4af-1fdd-41ea-31e7-08dc4f7c6039 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 23:11:19.0259 (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: AS1P250MB0553 Subject: [FFmpeg-devel] [PATCH 11/18] lib*/version: Use static_assert for static asserts 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: Xu37pU0rAXIB Also update the checks that guard against inserting a new enum entry in the middle of a range. Signed-off-by: Andreas Rheinhardt --- libavcodec/version.c | 16 +++++++++++----- libavdevice/version.c | 5 +++-- libavfilter/version.c | 5 +++-- libavformat/version.c | 5 +++-- libavutil/version.c | 12 +++++++----- libpostproc/version.c | 5 +++-- libswresample/version.c | 5 +++-- libswscale/version.c | 5 +++-- 8 files changed, 36 insertions(+), 22 deletions(-) diff --git a/libavcodec/version.c b/libavcodec/version.c index d7966b2015..27f94323b8 100644 --- a/libavcodec/version.c +++ b/libavcodec/version.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "avcodec.h" #include "codec_id.h" #include "version.h" @@ -30,10 +31,15 @@ const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned avcodec_version(void) { - av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563); - av_assert0(AV_CODEC_ID_ADPCM_G722==69660); - av_assert0(AV_CODEC_ID_SRT==94216); - av_assert0(LIBAVCODEC_VERSION_MICRO >= 100); + static_assert(AV_CODEC_ID_LEAD == 269 && + AV_CODEC_ID_PCM_SGA == 65572 && + AV_CODEC_ID_ADPCM_XMD == 69683 && + AV_CODEC_ID_CBD2_DPCM == 81928 && + AV_CODEC_ID_QOA == 86121 && + AV_CODEC_ID_ARIB_CAPTION == 94233 && + AV_CODEC_ID_SMPTE_2038 == 98315, + "Don't insert new codec ids in the middle of a list"); + static_assert(LIBAVCODEC_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBAVCODEC_VERSION_INT; } diff --git a/libavdevice/version.c b/libavdevice/version.c index 92d7f2d159..a058efe46e 100644 --- a/libavdevice/version.c +++ b/libavdevice/version.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "avdevice.h" #include "version.h" @@ -29,7 +30,7 @@ const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned avdevice_version(void) { - av_assert0(LIBAVDEVICE_VERSION_MICRO >= 100); + static_assert(LIBAVDEVICE_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBAVDEVICE_VERSION_INT; } diff --git a/libavfilter/version.c b/libavfilter/version.c index db1a2511e7..54c286460e 100644 --- a/libavfilter/version.c +++ b/libavfilter/version.c @@ -18,8 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "avfilter.h" #include "version.h" @@ -28,7 +29,7 @@ const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned avfilter_version(void) { - av_assert0(LIBAVFILTER_VERSION_MICRO >= 100); + static_assert(LIBAVFILTER_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBAVFILTER_VERSION_INT; } diff --git a/libavformat/version.c b/libavformat/version.c index 5f321d847e..c0781d3f47 100644 --- a/libavformat/version.c +++ b/libavformat/version.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "avformat.h" #include "version.h" @@ -29,7 +30,7 @@ const char av_format_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned avformat_version(void) { - av_assert0(LIBAVFORMAT_VERSION_MICRO >= 100); + static_assert(LIBAVFORMAT_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBAVFORMAT_VERSION_INT; } diff --git a/libavutil/version.c b/libavutil/version.c index baead7c4a0..afab190336 100644 --- a/libavutil/version.c +++ b/libavutil/version.c @@ -18,8 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "avassert.h" #include "avutil.h" #include "samplefmt.h" #include "version.h" @@ -34,10 +35,11 @@ const char *av_version_info(void) unsigned avutil_version(void) { - av_assert0(AV_SAMPLE_FMT_DBLP == 9); - av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4); - av_assert0(AV_PICTURE_TYPE_BI == 7); - av_assert0(LIBAVUTIL_VERSION_MICRO >= 100); + static_assert(AV_SAMPLE_FMT_S64P == 11 && + AVMEDIA_TYPE_ATTACHMENT == 4 && + AV_PICTURE_TYPE_BI == 7, + "Don't insert new sample/media/picture types in the middle of the list"); + static_assert(LIBAVUTIL_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBAVUTIL_VERSION_INT; } diff --git a/libpostproc/version.c b/libpostproc/version.c index 494575ae67..304abe08e6 100644 --- a/libpostproc/version.c +++ b/libpostproc/version.c @@ -18,8 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "postprocess.h" #include "version.h" @@ -28,7 +29,7 @@ const char postproc_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned postproc_version(void) { - av_assert0(LIBPOSTPROC_VERSION_MICRO >= 100); + static_assert(LIBPOSTPROC_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBPOSTPROC_VERSION_INT; } diff --git a/libswresample/version.c b/libswresample/version.c index 00f71e3393..40fbbabf96 100644 --- a/libswresample/version.c +++ b/libswresample/version.c @@ -18,8 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "swresample.h" #include "version.h" @@ -28,7 +29,7 @@ const char swr_ffversion[] = "FFmpeg version " FFMPEG_VERSION; unsigned swresample_version(void) { - av_assert0(LIBSWRESAMPLE_VERSION_MICRO >= 100); + static_assert(LIBSWRESAMPLE_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBSWRESAMPLE_VERSION_INT; } diff --git a/libswscale/version.c b/libswscale/version.c index b165e2563e..31135f9cb1 100644 --- a/libswscale/version.c +++ b/libswscale/version.c @@ -18,14 +18,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "config.h" -#include "libavutil/avassert.h" #include "swscale.h" #include "version.h" unsigned swscale_version(void) { - av_assert0(LIBSWSCALE_VERSION_MICRO >= 100); + static_assert(LIBSWSCALE_VERSION_MICRO >= 100, "micro version starts at 100"); return LIBSWSCALE_VERSION_INT; }