URL: <https://savannah.gnu.org/bugs/?66416>
Summary: tests broken on c23
Group: GNU Screen
Submitter: themusicgod1
Submitted: Wed 06 Nov 2024 12:56:51 PM CST
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release: 5.0.0
Fixed Release: None
Planned Release: None
Work Required: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 06 Nov 2024 12:56:51 PM CST By: Jeffrey Cliff <themusicgod1>
gcc gcc (GCC) 15.0.0 20240509 (experimental)
with CFLAGS=""
screen 5.0
./configure arguments:
--prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man
--disable-pam
--enable-socket-dir=/run/screen --with-pty-group=5
--with-system_screenrc=/etc/screenrc
gcc 15 seems to be more strict about casting, the attached patch makes the
tests at least compile to the point where the assertions fail
types of failures
1)
SIGNATURE_CHECK is checking an incorrect signature
tests/test-winmsgcond.c:29:17: error: initialization of ‘void (*)(WinMsgCond
*, char *)’ from incompatible pointer type ‘void (*)(WinMsgCond *, int)’
[-Wincompatible-pointer-types]
29 | SIGNATURE_CHECK(wmc_init, void, (WinMsgCond *, char *));
| ^~~~~~~~
tests/signature.h:46:71: note: in definition of macro ‘SIGNATURE_CHECK2’
46 | static ret (* __attribute__((unused)) signature_check ## id) args =
fn
|
^~
tests/signature.h:39:3: note: in expansion of macro ‘SIGNATURE_CHECK1’
39 | SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
| ^~~~~~~~~~~~~~~~
tests/test-winmsgcond.c:29:1: note: in expansion of macro
‘SIGNATURE_CHECK’
29 | SIGNATURE_CHECK(wmc_init, void, (WinMsgCond *, char *));
| ^~~~~~~~~~~~~~~
tests/test-winmsgcond.c:34:17: error: initialization of ‘char *
(*)(WinMsgCond *, char *, _Bool *)’ from incompatible pointer type ‘int
(*)(WinMsgCond *, int, _Bool *)’ [-Wincompatible-pointer-types]
34 | SIGNATURE_CHECK(wmc_else, char *, (WinMsgCond *, char *, bool *));
| ^~~~~~~~
tests/signature.h:46:71: note: in definition of macro ‘SIGNATURE_CHECK2’
46 | static ret (* __attribute__((unused)) signature_check ## id) args =
fn
|
^~
tests/signature.h:39:3: note: in expansion of macro ‘SIGNATURE_CHECK1’
39 | SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
| ^~~~~~~~~~~~~~~~
tests/test-winmsgcond.c:34:1: note: in expansion of macro
‘SIGNATURE_CHECK’
34 | SIGNATURE_CHECK(wmc_else, char *, (WinMsgCond *, char *, bool *));
| ^~~~~~~~~~~~~~~
2)
casts from pointers without a cast are more strict in c23
tests/test-winmsgcond.c: In function ‘main’:
tests/test-winmsgcond.c:46:32: error: passing argument 2 of ‘wmc_init’
makes integer from pointer without a cast [-Wint-conversion]
46 | wmc_init(&wmc, pos);
| ^~~
| |
| char *
In file included from tests/test-winmsgcond.c:27:
tests/test-winmsgcond.c:53:42: error: passing argument 2 of ‘wmc_end’
makes integer from pointer without a cast [-Wint-conversion]
53 | ASSERT(wmc_end(&wmc, pos + 1, &chg) == pos);
| ~~~~^~~
| |
| char *
the attached patch explicitly casts enough to get these errors to no longer be
errors.
3)
for some reason when "make check" is run _GNU_SOURCE is not defined
this leads to mallocmock_reset not being defined at linking stage
/sources/gnu/screen-5.0.0/tests/test-winmsgbuf.c:62:(.text.startup+0x5a):
undefined reference to `mallocmock_reset'
/usr/bin/ld:
/sources/gnu/screen-5.0.0/tests/test-winmsgbuf.c:66:(.text.startup+0x8d):
undefined reference to `mallocmock_reset'
/usr/bin/ld:
/sources/gnu/screen-5.0.0/tests/test-winmsgbuf.c:67:(.text.startup+0xc7):
undefined reference to `mallocmock_reset'
/usr/bin/ld:
/sources/gnu/screen-5.0.0/tests/test-winmsgbuf.c:68:(.text.startup+0x100):
undefined reference to `mallocmock_reset'
collect2: error: ld returned 1 exit status
configure *does* adds it to config.h correctly
# grep -i '_GNU_SOURCE' config.h
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
but when make check occurs
gcc -iquote. -DSCREENENCODINGS='"/usr/share/screen/utf8encodings"'
-DBUILD_DATE='"2024-11-06 12:11:24"' -g -O2 -Wall -Wextra -std=c17
tests/test-winmsgbuf.c -o tests/test-winmsgbuf winmsgbuf.o tests/mallocmock.o
it fails.
one solution is just to remove the definition of mallocmock_reset from the
ifdef defining _GNU_SOURCE but this is probably not the correct way to solve
that.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Name: screen-test2.patch Size: 6KiB
<https://file.savannah.gnu.org/file/screen-test2.patch?file_id=56603>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-21bf471d45f95fa6e30d8e85c908b9fa986c6d9b.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66416>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
