Skip to content

libopendkim: fix -Wpointer-sign warnings in header-name arrays and dkim_get_header() (part of #361) - #429

Merged
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:fix/issue-361-pointer-sign-partial
Jul 22, 2026
Merged

libopendkim: fix -Wpointer-sign warnings in header-name arrays and dkim_get_header() (part of #361)#429
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:fix/issue-361-pointer-sign-partial

Conversation

@thegushi

Copy link
Copy Markdown
Collaborator

Summary

Partial fix for #361 (clang reports 150 -Wpointer-sign warnings 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[], and dkim_required_signhdrs[] in dkim.c were declared const u_char *[] but initialized from ordinary string literals, warning once per array entry. Retyped to const char *[] (and the matching extern decls in dkim.h) to match.
  • dkim_get_header() took u_char *name but is called almost exclusively with string literals ("Date", "From", etc.). Retyped to char *name; added a cast at its one remaining call site that passes a genuine u_char * (dkiml_mbs[]).

No behavior change — char and unsigned char share 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-sign warnings dropped from 150 to 112, 0 errors.
  • make check: 174/174 tests passing.
  • Default gcc14 build (no explicit flags) and gcc14 -Wall build both still succeed with 0 errors.

@thegushi thegushi mentioned this pull request Jul 22, 2026
1 task
…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
thegushi force-pushed the fix/issue-361-pointer-sign-partial branch from d787712 to 82998a4 Compare July 22, 2026 07:38
@thegushi
thegushi merged commit f6a7def into trusteddomainproject:develop Jul 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant