tests: add the includes the C testers rely on implicitly - #4831
Draft
ThalesBarretto wants to merge 1 commit into
Draft
ThalesBarretto wants to merge 1 commit into
ThalesBarretto wants to merge 1 commit into
Conversation
Eight test programs built by build_tester call functions they never
declare: close(), read(), write(), lseek(), fork(), getppid() and
sleep() without <unistd.h>, system() without <stdlib.h>, inet_pton()
and inet_net_pton() without <arpa/inet.h>, and major()/minor()/makedev()
without <sys/sysmacros.h>. GCC 14 made an implicit function declaration
a hard error (it was a warning before), so on any toolchain from 2024 on
build_tester fails and the tests that depend on it fail before running:
tests/bugs/cidr-bug-4108.t, bugs/distribute/bug-1193636.t,
bugs/fuse/bug-1126048.t, bugs/protocol/bug-808400{,-dist,-repl}.t,
bugs/write-behind/bug-1058663.t and bug-1279730.t.
Add the missing includes. The two bug-808400 testers also called the
LFS64 name fstat64() on a plain struct stat, which only compiled because
the call was undeclared; call fstat() and drop the non-Linux macro that
already mapped one onto the other. logchecks.c is not built by any test
but gets its include too.
Fixes: gluster#4830
Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
ThalesBarretto
marked this pull request as draft
September 22, 2026 10:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests: add the includes the C testers rely on implicitly
Eight test programs built by
build_testercall libc functions they never declare (close,read,write,lseek,fork,getppid,sleepwithout<unistd.h>;systemwithout<stdlib.h>;inet_ptonandinet_net_ptonwithout<arpa/inet.h>;major/minor/makedevwithout<sys/sysmacros.h>). GCC 14 madean implicit declaration a hard error, so on a current toolchain
build_testerfails and eight tests neverrun. Details in #4830.
The change (8 files, +14/-12,
tests/only)Add the missing includes. The two
bug-808400testers also called the LFS64 namefstat64()on a plainstruct stat, which compiled only because the call was undeclared; they now callfstat(), and thenon-Linux macro that mapped one onto the other is gone.
Test
Before: 8 of the 99
.cfiles undertests/failgcc -fsyntax-only -Werror=implicit-function-declaration(the GCC 14 default); after: 0. On GCC 14.2 the affected
.tfiles fail atbuild_testerbefore and buildafter. No behaviour change in any tester.
Fixes: #4830