libopendkim: fix -Wpointer-sign warnings in header-name arrays and dkim_get_header() (part of #361) - #429
Merged
thegushi merged 1 commit intoJul 22, 2026
Conversation
…im_get_header() Addresses part of issue trusteddomainproject#361 (150 clang -Wpointer-sign warnings across libopendkim and opendkim). Two changes account for 38 of the 150: - dkim_should_signhdrs[], dkim_should_not_signhdrs[], and dkim_required_signhdrs[] were declared const u_char *[] but initialized from ordinary string literals, warning once per entry. Retyped to const char *[] to match. - dkim_get_header() took u_char *name but is called almost exclusively with string literals. Retyped to char *name, adding a cast at its one remaining u_char *-typed call site (dkiml_mbs[]). No behavior change (char and unsigned char share representation on every platform this builds for). Verified with a clang -Wpointer-sign build (150 -> 112 unique warnings) and `make check` (174/174 passing). The remaining ~112 warnings are scattered single-site mismatches needing individual judgment; left for a follow-up.
thegushi
force-pushed
the
fix/issue-361-pointer-sign-partial
branch
from
July 22, 2026 07:38
d787712 to
82998a4
Compare
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.
Summary
Partial fix for #361 (clang reports 150
-Wpointer-signwarnings across libopendkim/opendkim). This PR addresses the two highest-yield, lowest-risk sources, accounting for 38 of the 150:dkim_should_signhdrs[],dkim_should_not_signhdrs[], anddkim_required_signhdrs[]indkim.cwere declaredconst u_char *[]but initialized from ordinary string literals, warning once per array entry. Retyped toconst char *[](and the matchingexterndecls indkim.h) to match.dkim_get_header()tooku_char *namebut is called almost exclusively with string literals ("Date","From", etc.). Retyped tochar *name; added a cast at its one remaining call site that passes a genuineu_char *(dkiml_mbs[]).No behavior change —
charandunsigned charshare representation on every platform this builds for.The remaining ~112 warnings are scattered single-site mismatches that need individual judgment (cast vs. retyping the variable to match dominant usage) and are left for a follow-up PR.
Test plan
CC=clang ./configure CFLAGS="-Wpointer-sign -g -O0"+make: unique-Wpointer-signwarnings dropped from 150 to 112, 0 errors.make check: 174/174 tests passing.gcc14build (no explicit flags) andgcc14 -Wallbuild both still succeed with 0 errors.