sci-libs/cfitsio: port to C23

Rename nullptr to ptr_to_null, as it points to null in string, not
is pointer that is null.

Closes: https://bugs.gentoo.org/943959
Closes: https://bugs.gentoo.org/944747
Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40826
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
NHOrus
2025-03-01 13:27:14 +04:00
committed by Sam James
parent de2495100b
commit 7ac36f22a5
2 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake-multilib fortran-2
DESCRIPTION="C and Fortran library for manipulating FITS files"
HOMEPAGE="https://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html"
SRC_URI="https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/${P}.tar.gz"
LICENSE="ISC"
SLOT="0/10-r1"
KEYWORDS="~alpha ~amd64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
IUSE="bzip2 curl test tools"
RESTRICT="!test? ( test )"
BDEPEND="
app-alternatives/yacc
app-alternatives/lex
"
RDEPEND="
sys-libs/zlib[${MULTILIB_USEDEP}]
bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
curl? ( net-misc/curl[${MULTILIB_USEDEP}] )
"
# Bug #803350
DEPEND="
${RDEPEND}
<dev-lang/cfortran-20110621
"
PATCHES=( "${FILESDIR}/${P}-rename-nullptr.patch" )
pkg_setup() {
fortran-2_pkg_setup
}
src_prepare() {
cmake_src_prepare
# fix libdir
sed -e 's:lib/::' -i CMakeLists.txt || die
# Avoid internal cfortran
rm cfortran.h || die
}
multilib_src_configure() {
local libdir=$(get_libdir)
local mycmakeargs=(
# used for .pc file
-DLIB_SUFFIX=${libdir#lib}
-DUSE_BZIP2=$(usex bzip2)
-DUSE_CURL=$(usex curl)
-DUSE_PTHREADS=ON
# just appending CFLAGS
-DUSE_SSE2=OFF
-DUSE_SSSE3=OFF
-DTESTS=$(usex test)
-DUTILS=$(multilib_native_usex tools)
)
cmake_src_configure
}
multilib_src_install_all() {
dodoc README.md docs/*.pdf
docinto examples
dodoc utilities/{cookbook.{c,f},testprog.c,testf77.f,speed.c,smem.c}
}

View File

@@ -0,0 +1,51 @@
Nullptr is reserved keyword in C23. Rename to something that describes usage better
https://bugs.gentoo.org/944747
--- a/putcol.c
+++ b/putcol.c
@@ -1226,7 +1226,7 @@
long rept, rowrept, width, tnull, naxes[9] = {1,1,1,1,1,1,1,1,1}, groups;
double zeros = 0.;
char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], nullstr[FLEN_VALUE];
- char **stringptr, *nullptr, *cptr;
+ char **stringptr, *ptr_to_null, *cptr;
if (*status > 0)
return(*status);
@@ -2081,24 +2081,24 @@
{
stringptr = cols[jj].array;
dataptr = stringptr + 1;
- nullptr = *stringptr;
+ ptr_to_null = *stringptr;
nbytes = 2;
}
else
{
dataptr = (char *) cols[jj].array + col[jj].nullsize;
- nullptr = (char *) cols[jj].array;
+ ptr_to_null = (char *) cols[jj].array;
nbytes = col[jj].nullsize;
}
- if (memcmp(nullptr, &zeros, nbytes) )
+ if (memcmp(ptr_to_null, &zeros, nbytes) )
{
/* null value flag not zero; must check for and write nulls */
if (hdutype == IMAGE_HDU)
{
if (ffppn(cols[jj].fptr, cols[jj].datatype,
felement, cols[jj].repeat * ntodo, dataptr,
- nullptr, &tstatus) > 0)
+ ptr_to_null, &tstatus) > 0)
break;
}
else
@@ -2113,7 +2113,7 @@
if (ffpcn(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow,
felement, cols[jj].repeat * ntodo, dataptr,
- nullptr, &tstatus) > 0)
+ ptr_to_null, &tstatus) > 0)
break;
}
}