From patchwork Tue May 23 11:19:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 18646 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5E278C3284 for ; Tue, 23 May 2023 11:20:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8C8766285F; Tue, 23 May 2023 13:20:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1684840801; bh=s8Pb5nIe+0N8NmfsXBWO7RbN7v8Fa2K9Q/kYu4j8JUA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=G8nMxz+lLHD4/9iCWs/eOVUuXJ17E+SQue3rCC5D/gBCXPteCavaFhl5hYj3rzeBv E6oQv/itMIQRc+o5PbfS3zhLc4x8kN8mBwUL5u7gcyLr8Zft6RSFCDIfXXwuKBB6G+ 06kMqGFfd3X/Pa8vwYhn7QLAU/Lxti9j3OuJpAk2E43waGhDnyBWHBd0QDyNDG//iV HBexX5E6fHifZi1mxI5usbvaRwZXD20Pz8r7YXtHnv6gOJxmCtoSNSKS7o/NPE4It1 t1DdMdP3AWA+zH3lFHqrX3dlHFdGNDyPbKUeeAMI795pvE0j5gYU9pzeC2BwvBxk0X M+HJ+VE85W5cg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 33AA5603F7 for ; Tue, 23 May 2023 13:20:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CdVp0VF+"; dkim-atps=neutral Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E887F881; Tue, 23 May 2023 13:19:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1684840784; bh=s8Pb5nIe+0N8NmfsXBWO7RbN7v8Fa2K9Q/kYu4j8JUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdVp0VF+yEVVccoA32OZv9jU5/hOLJXIzAqnQK7RWcZRqIRIUJE0qtKqD/n/NG0bA X1IlGzQyERnZhax5oCJpyeAYSBGsELBaphMIuq32T9CwgLzFXG+aJdvpZ5rzwumzVK J+evpyxutVve0/5cYe4MgtiAEtSBto2zU+dZgix8= To: libcamera devel Date: Tue, 23 May 2023 12:19:48 +0100 Message-Id: <20230523111948.2832224-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230509231542.1123025-1-pobrn@protonmail.com> References: <20230509231542.1123025-1-pobrn@protonmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/2] libcamera: deprecated: Add new deprecated header X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Provide a new header that will be included when applications use to bring in additional context and warnings to generate when the libcamera API is modified where possible. Introduce a deprecated implemenation of StreamRoles to report that StreamRoles is no longer a libcamera definition. This allows the compiler to report the following when the header is available: ../../src/apps/qcam/main_window.cpp: In member function ‘int MainWindow::startCapture()’: ../../src/apps/qcam/main_window.cpp:366:21: error: ‘using StreamRoles = class std::vector’ is deprecated: Use a span, array or vector directly [-Werror=deprecated-declarations] 366 | StreamRoles roles = StreamKeyValueParser::roles(options_[OptStream]); | ^~~~~ In file included from include/libcamera/libcamera.h:16, from ../../src/apps/qcam/main_window.cpp:14: ../../include/libcamera/deprecated.h:21:7: note: declared here 21 | using StreamRoles [[deprecated("Use a span, array or vector directly")]] | ^~~~~~~~~~~ Signed-off-by: Kieran Bingham --- This is a proposal to support reporting deprecated functionality to applications at compile time. include/libcamera/deprecated.h | 24 ++++++++++++++++++++++++ include/libcamera/meson.build | 1 + 2 files changed, 25 insertions(+) create mode 100644 include/libcamera/deprecated.h diff --git a/include/libcamera/deprecated.h b/include/libcamera/deprecated.h new file mode 100644 index 000000000000..ba48d5a142dc --- /dev/null +++ b/include/libcamera/deprecated.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2023, Ideas on Board Oy. + * + * deprecated.h - Deprecated API reporting + * + * Deprecated features of the API will be exposed here for at least one release + * iteration to ease reporting of API adjustments for applications. + */ + +#pragma once + +namespace libcamera { + +/* + * Deprectated following v0.0.5 + * + * The use of StreamRoles indicates applications to use dynamic allocations + * of the StreamRole when this is not always required. + */ +using StreamRoles [[deprecated("Use a span, array or vector directly")]] + = std::vector; + +} /* namespace libcamera */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 408b7acf152c..2f470d2ac61e 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -7,6 +7,7 @@ libcamera_public_headers = files([ 'camera_manager.h', 'color_space.h', 'controls.h', + 'deprecated.h', 'fence.h', 'framebuffer.h', 'framebuffer_allocator.h',