Backport upstream fix for avoiding c++ keyword

This commit is contained in:
Mamoru TASAKA 2022-02-14 14:17:37 +09:00
parent 32a3f3ac57
commit 810e315ae3
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 39047be58de0f7f1e58b9866ef7f78722fba9bf1 Mon Sep 17 00:00:00 2001
From: Michael Adams <mdadams@ece.uvic.ca>
Date: Sat, 12 Feb 2022 07:36:21 -0800
Subject: [PATCH] Fixes #318.
Eliminated the use of "class" as an identifier, as this will clearly cause
problems if JasPer headers are used in C++ source code.
In order to catch incompatibilities with C++ in the future, a trivial C++
test program has been added.
The CMake build process was adjusted to (optionally) allow the use of a
C++ compiler.
Each use of add_compile_options that sets C compiler options was changed
to use a new function called add_c_compile_options that only sets options
for the C compiler.
Some changes to the CMake module for code sanitizers were made in order to
handle the C++ compiler case.
Several new options were added to the build script.
---
CMakeLists.txt | 61 ++++++++++++++++----------
build/build | 26 +++++++++++
build/build_all | 36 +++++++++++++++
build/cmake/modules/Sanitizers.cmake | 6 +++
src/app/CMakeLists.txt | 8 ++++
src/app/test_2.cpp | 21 +++++++++
src/libjasper/include/jasper/jas_log.h | 6 +--
7 files changed, 137 insertions(+), 27 deletions(-)
create mode 100644 src/app/test_2.cpp
diff --git a/src/libjasper/include/jasper/jas_log.h b/src/libjasper/include/jasper/jas_log.h
index e2ef5b61..dc4228b5 100644
--- a/src/libjasper/include/jasper/jas_log.h
+++ b/src/libjasper/include/jasper/jas_log.h
@@ -119,11 +119,11 @@ typedef int (jas_vlogmsgf_t)(jas_logtype_t, const char *, va_list);
/*!
@brief Create an instance of a logtype.
*/
-static inline jas_logtype_t jas_logtype_init(int class, int priority)
+static inline jas_logtype_t jas_logtype_init(int clas, int priority)
{
- assert(class >= 0 && class < JAS_LOGTYPE_NUM_CLASSES);
+ assert(clas >= 0 && clas < JAS_LOGTYPE_NUM_CLASSES);
assert(priority >= 0 && priority <= JAS_LOGTYPE_MAX_PRIORITY);
- return (class & 0xf) | (priority << 4);
+ return (clas & 0xf) | (priority << 4);
}
/*!

View File

@ -6,7 +6,7 @@
Summary: Implementation of the JPEG-2000 standard, Part 1
Name: jasper
Version: 3.0.0
Release: 3%{?dist}
Release: 4%{?dist}
License: JasPer
URL: http://www.ece.uvic.ca/~frodo/jasper/
@ -14,6 +14,9 @@ Source0: https://github.com/jasper-software/jasper/archive/%{name}-version-%{ver
# skip hard-coded prefix/lib rpath
Patch1: jasper-3.0.0-rpath.patch
# https://github.com/jasper-software/jasper/issues/318
# https://github.com/jasper-software/jasper/commit/39047be58de0f7f1e58b9866ef7f78722fba9bf1
Patch2: jasper-3.0.0-class-cplusplus-keyword.patch
# architecture related patches
Patch100: jasper-2.0.2-test-ppc64-disable.patch
@ -64,6 +67,7 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%setup -q -n %{name}-version-%{version}
%patch1 -p1 -b .rpath
%patch2 -p1 -b .keyword
# Need to disable one test to be able to build it on ppc64 arch
# At ppc64 this test just stuck (nothing happend - no exception or error)
@ -126,6 +130,9 @@ make test -C builder
%changelog
* Mon Feb 14 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.0.0-4
- Backport upstream fix for avoiding c++ keyword
* Sun Feb 13 2022 Josef Ridky <jridky@redhat.com> - 3.0.0-3
- Rebuilt for libjasper.so.6