From patchwork Thu Nov 13 11:05:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 25013 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 CFCFBC32DB for ; Thu, 13 Nov 2025 11:10:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE8E260AA2; Thu, 13 Nov 2025 12:10:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="sOjVRHwF"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 52F4C609D8 for ; Thu, 13 Nov 2025 12:10:02 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-470ff9b5820so349985e9.3 for ; Thu, 13 Nov 2025 03:10:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1763032202; x=1763637002; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eLYgfasp6wjRbwdDpzqUSmDnPzR4sNOIiUWmIY2H3S8=; b=sOjVRHwFx4rLEsulpGJf6G1tWV7Ys9uMqJAp93gjkuRwOoVncaQXTZ1cXTInPxPHB7 +SnxiUFOwahxVlZXuMJF8FcmpiW32XvmMEfKejXmCoNgaZhKdrVoZKxAH/q9xxD6LBrM UagGZex89Hawar1yK2bjL3JSCQ8HzeEDDzdS0oyXv2gS3ZoWOGN026YtksiHLPj0aUcJ zDqBhpD/qgQEFWUV35i5s259eRmaufWNR5tNtexRqj6nAvoWf/MVV0tuPx9hhym8XNNj LDHb1vzGlWo/HhniFH+HdWVTZHBmcfpxXPaAKDW328Ai6SmlS5tjghBhYNox+JFlGRcy jiAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763032202; x=1763637002; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eLYgfasp6wjRbwdDpzqUSmDnPzR4sNOIiUWmIY2H3S8=; b=hWNoSQAKLCJS0vVCnmVufwFJieN+2T9W9PxgT5A3LkRb44y5ewoMRS68ii19rHEBDf hrz+Za4u/mseKqWr+defvJltSB4ZOhOoMXLH8nNzTqpTNcPtqeQK1Al1erJQJgxkLw/U 5UZ5aaMM3oGv8W9zLX8UyOpylkrm2FFN4WgCSGpawxSmdVm3ZIt/bxNhziCa9OiEM4nT ug+nwwmetshmwUNg8tP+pfkMJiykTPWGJEglTvkKoOxN84REKuVVUjrP0xpfW8nLRCV8 fEuyQBNop90DEwM/Wu6Km58D+p9ITzAYC8Net4VVHEKjnLu/To1zvqS499pI6fFTDsqP MtQw== X-Gm-Message-State: AOJu0YxnHvPEA8gp8/c/XUfDHrKJLs1zMZoeadIAL+ar0emt0NzYfRmp yTQevw/aQEu3rEvqFCKSFlOspfMMsseenuQBTAX/O0bKsSu5ndPGirWPzFTvvIuSbcVTyD5SmeT x5ENS X-Gm-Gg: ASbGnctBJqiCRhV21/z5cbLoZWYW2cms1sZNkKrh6VXtQnL7gJkevnucjTf1i9Brb9I 7S2Zl/FKAtXKj6iq9uiYLV96IZHjxgFF19AGH80SoogIhoI350EoauoUHgFdRtuQaqSq7cJ3PgK gWq9yTTLigVT9+y2oHKpQUcmBwC0rgjgA3g9Eh1hlUT6Sf2Narw1EfFLNTD9RfdvknaHpkknd5U i2rCzEP3uQcxcNfsZmLhYxyxUqibM/65dHFX1ZmB/vGZBJTFSpRmX6q8QNQkRHgSCnE2IcrYC8G 7xs+YrHqWVkeZuL1nC8JH4w94rBkMZpUPlvZTFna5GJkKf69CMrXuj2Ruc3+7VvkdK+R5EGi1mI IIKysR4744Eta7TNXZPV+OqfDVgZ6XiBfQZQaX9+vABduPZB65Xba4djpinMDc0WWDxEgJpJf50 QjMP/3hjvGdmxHPgAP6FG1 X-Google-Smtp-Source: AGHT+IHbY81bN6eNl1SkxZgxeJU+xowmYj7QaRY36/4BiaNQ2kVzgTT83WV0lVWPei2E6d3/EwDrYw== X-Received: by 2002:a05:6000:4022:b0:42b:3746:3b83 with SMTP id ffacd0b85a97d-42b530a4aa3mr1057261f8f.8.1763032201551; Thu, 13 Nov 2025 03:10:01 -0800 (PST) Received: from naush-dell.pitowers.org ([2a00:1098:3142:1f:2656:5224:553b:c3da]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53e7aea7sm3259935f8f.1.2025.11.13.03.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Nov 2025 03:10:01 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [RFC PATCH v1 1/1] treewide: Update to the C++20 standard Date: Thu, 13 Nov 2025 11:05:31 +0000 Message-ID: <20251113110958.1117065-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251113110958.1117065-1-naush@raspberrypi.com> References: <20251113110958.1117065-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Switch to using the C++20 standard when compiling libcamera. This causes a build error due to the deprecation of the following specialisation [1] std::shared_ptr atomic_load(const std::shared_ptr* p) ../src/libcamera/base/log.cpp: In member function 'void libcamera::Logger::write(const libcamera::LogMessage&)': ../src/libcamera/base/log.cpp:468:61: error: 'std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = libcamera::LogOutput]' is deprecated: use 'std::atomic>' instead [-Werror=deprecated-declarations] 468 | std::shared_ptr output = std::atomic_load(&output_); | ~~~~~~~~~~~~~~~~^~~~~~~~~~ This error is fixed by switching to the std::atomic> specialisation instead. Unfortunately, this is not backward compatible with C++17, so the fix must be included in this commit. [1]: https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic.html Signed-off-by: Naushir Patuck --- meson.build | 2 +- src/libcamera/base/log.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index fd508fd7f6b5..74153e1e6ce9 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project('libcamera', 'c', 'cpp', default_options : [ 'werror=true', 'warning_level=2', - 'cpp_std=c++17', + 'cpp_std=c++20', ], license : 'LGPL 2.1+') diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp index 81b550e21402..e65d83739315 100644 --- a/src/libcamera/base/log.cpp +++ b/src/libcamera/base/log.cpp @@ -325,7 +325,7 @@ private: std::vector> categories_ LIBCAMERA_TSA_GUARDED_BY(mutex_); std::list> levels_; - std::shared_ptr output_; + std::atomic> output_; }; bool Logger::destroyed_ = false; @@ -465,7 +465,7 @@ Logger *Logger::instance() */ void Logger::write(const LogMessage &msg) { - std::shared_ptr output = std::atomic_load(&output_); + std::shared_ptr output = output_.load(); if (!output) return; @@ -477,7 +477,7 @@ void Logger::write(const LogMessage &msg) */ void Logger::backtrace() { - std::shared_ptr output = std::atomic_load(&output_); + std::shared_ptr output = output_.load(); if (!output) return;