!31 Do not define the clamp macro when compiling C++ code

From: @chen-jan 
Reviewed-by: @wang--ge 
Signed-off-by: @wang--ge
This commit is contained in:
openeuler-ci-bot 2023-07-20 09:15:28 +00:00 committed by Gitee
commit cbeb6ba989
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 7149af4125f76422e320c3d1f9d9308e9259bdf9 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Wed, 23 Dec 2020 17:23:49 +0100
Subject: [PATCH] libdpkg: Do not define the clamp macro when compiling C++
code
Newer versions of the C++ standard define a clamp function in the STL,
which gets messed up by our macro.
Reported-by: Helmut Grohne <helmut@subdivi.de>
Warned-by: g++ -std=gnu++17
Changelog: internal
reference: https://git.dpkg.org/git/dpkg/dpkg.git/commit/?id=7149af4125f76422e320c3d1f9d9308e9259bdf9
---
lib/dpkg/macros.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/dpkg/macros.h b/lib/dpkg/macros.h
index 6eaedf844..a4776570a 100644
--- a/lib/dpkg/macros.h
+++ b/lib/dpkg/macros.h
@@ -153,9 +153,12 @@
* @param l The low limit.
* @param h The high limit.
*/
+/* For C++ use native implementations from STL or similar. */
+#ifndef __cplusplus
#ifndef clamp
#define clamp(v, l, h) ((v) > (h) ? (h) : ((v) < (l) ? (l) : (v)))
#endif
+#endif
/** @} */
--
2.41.0

View File

@ -2,7 +2,7 @@
Name: dpkg
Version: 1.18.25
Release: 13
Release: 14
Summary: Package maintenance system for Debian Linux
License: GPL-2.0-only and GPL-2.0-or-later and LGPL-2.0-or-later and Public Domain and BSD-2-Clause
URL: https://tracker.debian.org/pkg/dpkg
@ -26,6 +26,7 @@ Patch1: dpkg-fix-logrotate.patch
Patch2: dpkg-log-Change-logfile-permission-to-satisfy-with-s.patch
Patch3: CVE-2022-1664.patch
Patch4: add-loongarch-support-for-dpkg.patch
Patch5: 0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch
%description
Dpkg is a tool to install, build, remove and manageDebian packages. The
@ -238,6 +239,9 @@ chown root:root /var/log/dpkg.log 2>/dev/null || chown 0:0 /var/log/dpkg.log
%endif
%changelog
* Thu Jul 20 2023 chenchen <chen_aka_jan@163.com> - 1.18.25-14
- Do not define the clamp macro when compiling C++ code
* Fri Mar 10 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 1.18.25-13
- add loongarch support for dpkg