fix: include <strings.h> for strncasecmp - #11
Open
bonifaido wants to merge 1 commit into
Open
Conversation
gcc 15 promotes implicit function declarations to errors, so the two strncasecmp() calls broke the build. Under -std=c99 glibc's string.h does not pull in strings.h, where POSIX declares it. Include it only in the standard-headers branch -- kernel builds go through SIGV4_SYSTEM_HEADER and get strncasecmp from linux/string.h. Cast the key to char * as aws_sigv4_strcmp() already does, so declaring the function doesn't just trade the error for -Wpointer-sign. Fixes #6
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.
Fixes #6.
gcc 15 promotes
-Wimplicit-function-declarationto an error, so the twostrncasecmp()calls insigv4.cfail the build. Under-std=c99(__STRICT_ANSI__) glibc'sstring.hdoes not pull instrings.h, where POSIX declares the function.Changes
sigv4.h: add#include <strings.h>, only inside the standard-headers branch. Kernel builds setSIGV4_SYSTEM_HEADERand take the other branch —strings.hdoes not exist there, andstrncasecmpcomes fromlinux/string.h.sigv4.c: castkey.data(unsigned char *) tochar *at both call sites, asaws_sigv4_strcmp()already does. Without this, declaring the function just trades the error for two new-Wpointer-signwarnings on the platforms that were already compiling.Verification
Reproduced and fixed on Ubuntu 26.04 / gcc 15.2.0 (
aarch64), matching the reporter's environment.Hosted build,
-Wall -Wextra -std=c99:strncasecmpimplicit declsigv4.cThe 7 remaining are pre-existing
-Wpointer-signonaws_sigv4_string("literal")— string literals passed asconst unsigned char *. Untouched here; separate cleanup.make test→100%: Checks: 6, Failures: 0, Errors: 0.Kernel path, compiled through
SIGV4_SYSTEM_HEADER="c_system_header.h"with the driver's flags plus-Werror=implicit-function-declaration: