Skip to content

Fix -Wundef warning in sha2.c - #309

Merged
wtoorop merged 1 commit into
NLnetLabs:developfrom
liweitianux:fix-wundef
Jun 18, 2026
Merged

Fix -Wundef warning in sha2.c#309
wtoorop merged 1 commit into
NLnetLabs:developfrom
liweitianux:fix-wundef

Conversation

@liweitianux

@liweitianux liweitianux commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

When -Wundef is specified, compiling sha2.c would give the following warning:

In file included from ./sha2.c:46:
./ldns/sha2.h:52:5: warning: ‘LDNS_BUILD_CONFIG_HAVE_INTTYPES_H’ is not defined, evaluates to ‘0’ [-Wundef]
   52 | #if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this warning by adding the necessary <ldns/common.h> include to sha2.c.

Meanwhile, adjust sha1.c to only include necessary headers, similar to sha2.c.

When '-Wundef' is specified, compiling sha2.c would give the following
warning:

```
In file included from ./sha2.c:46:
./ldns/sha2.h:52:5: warning: ‘LDNS_BUILD_CONFIG_HAVE_INTTYPES_H’ is not defined, evaluates to ‘0’ [-Wundef]
   52 | #if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Fix this warning by adding the necessary <ldns/common.h> include to
sha2.c.

Meanwhile, adjust sha1.c to only include necessary headers, similar to
sha2.c.
@wtoorop

wtoorop commented Jun 18, 2026

Copy link
Copy Markdown
Member

Yes, that looks good. Thanks.

@wtoorop
wtoorop merged commit 4bf706f into NLnetLabs:develop Jun 18, 2026
4 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.

2 participants