]> git.ipfire.org Git - thirdparty/pdns.git/commit
arc4random: Fix 'redundant redeclaration’ warnings 13197/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 31 Aug 2023 09:40:46 +0000 (11:40 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 31 Aug 2023 09:40:46 +0000 (11:40 +0200)
commit25d7b8d00e10b897c215eb1cff14a322971def15
tree732482dbdc7d112cbafd320686a7632ba2ec436a
parentb36632d55fd69a5c0a63e30986405c3ead37b320
arc4random: Fix 'redundant redeclaration’ warnings

If `arc4random.hh` is included before `config.h`, the `HAVE_*` defines
are not yet available and thus we include the definition of the following
functions even though they might be available in the standard headers:
- `arc4random`
- `arc4random_buf`
- `arc4random_uniform`
- `explicit_bzero`

Yielding warnings:
```
In file included from dns_random.hh:27,
                 from tsigutils.cc:25:
../ext/arc4random/arc4random.hh:9:12: warning: redundant redeclaration of ‘uint32_t arc4random()’ in same scope [-Wredundant-decls]
    9 |   uint32_t arc4random(void);
      |            ^~~~~~~~~~
In file included from /usr/include/c++/13.2.1/cstdlib:79,
                 from /usr/include/c++/13.2.1/ext/string_conversions.h:43,
                 from /usr/include/c++/13.2.1/bits/basic_string.h:4097,
                 from /usr/include/c++/13.2.1/string:54,
                 from dnsname.hh:26,
                 from tsigutils.cc:23:
/usr/include/stdlib.h:657:19: note: previous declaration of ‘__uint32_t arc4random()’
  657 | extern __uint32_t arc4random (void)
      |                   ^~~~~~~~~~
../ext/arc4random/arc4random.hh:12:8: warning: redundant redeclaration of ‘void arc4random_buf(void*, size_t)’ in same scope [-Wredundant-decls]
   12 |   void arc4random_buf(void* buf, size_t nbytes);
      |        ^~~~~~~~~~~~~~
/usr/include/stdlib.h:661:13: note: previous declaration of ‘void arc4random_buf(void*, size_t)’
  661 | extern void arc4random_buf (void *__buf, size_t __size)
      |             ^~~~~~~~~~~~~~
../ext/arc4random/arc4random.hh:15:12: warning: redundant redeclaration of ‘uint32_t arc4random_uniform(uint32_t)’ in same scope [-Wredundant-decls]
   15 |   uint32_t arc4random_uniform(uint32_t upper_bound);
      |            ^~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:666:19: note: previous declaration of ‘__uint32_t arc4random_uniform(__uint32_t)’
  666 | extern __uint32_t arc4random_uniform (__uint32_t __upper_bound)
      |                   ^~~~~~~~~~~~~~~~~~
../ext/arc4random/arc4random.hh:18:8: warning: redundant redeclaration of ‘void explicit_bzero(void*, size_t)’ in same scope [-Wredundant-decls]
   18 |   void explicit_bzero(void*, size_t len);
```
ext/arc4random/arc4random.hh