dutil: Add ____ilog2_NaN declaration to silence compiler warning

To deal with unrepresentable constant logarithms we end up causing a
build error, provide the declaration so that the compiler shut up.

Taken, as the other related code, from the Linux kernel sources.

For reference, the warning:

  [ 40%] Building C object CMakeFiles/dwarves_reorganize.dir/dwarves_reorganize.o
  /home/acme/git/pahole/dwarves_reorganize.c: In function ‘class__demote_bitfields’:
  /home/acme/git/pahole/dwarves_reorganize.c:536:168: warning: implicit declaration of function ‘____ilog2_NaN’ [-Wimplicit-function-declaration]

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2016-03-15 11:42:16 -03:00
parent 0b81b5ad47
commit ae3a2720c3
1 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,12 @@ int __ilog2_u64(uint64_t n)
return fls64(n) - 1;
}
/*
* deal with unrepresentable constant logarithms
*/
extern __attribute__((const, noreturn))
int ____ilog2_NaN(void);
/**
* ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value
* @n - parameter