Subject: bug#42236: 28.0.50; 118c07e02e breaks linux uclibc build

From: Stefan Kangas <[email-masked]>
Date: Wed, 12 Aug 2020 17:28:57 -0700

Are you still seeing this or has this been fixed?  I see several more
Gnulib related commits in the time since this was reported.

akater <[email-masked]> writes:

> Commit 118c07e02e939c9f52688091509d4bff2a897032 broke my
> x86_64-pc-linux-uclibc build with the following error (gcc-9.3.0):
>
>
>> x86_64-pc-linux-uclibc-gcc -c    -MMD -MF deps/getrandom.d -MP -fno-common -W -Wabsolute-value -Waddress -Waddress-of-packed-member -Waggressive-loop-optimizations -Wall -Wattribute-warning -Wattributes -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcannot-profile -Wcast-function-type -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wif-not-aligned -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces -Wmissing-declarations -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-profile -Wmissing-prototypes -Wmultichar -Wmultistatement-macros -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wstringop-truncation -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wswitch-bool -Wswitch-unreachable -Wtautological-compare -Wtrampolines -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wattribute-alias=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wnormalized=nfc -Wshift-overflow=2 -Wstringop-overflow=2 -Wvla-larger-than=4031 -Wredundant-decls -Wno-missing-field-initializers -Wno-override-init -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-format-nonliteral   -march=native -O2 -pipe -I. -I../src -I. -I./../src  getrandom.c
>> In file included from ./sys/random.h:36,
>>                  from getrandom.c:22:
>> /usr/include/sys/random.h:27:35: error: unknown type name 'size_t'
>>    27 | extern int getrandom(void *__buf, size_t count, unsigned int flags)
>>       |                                   ^~~~~~
>> /usr/include/sys/random.h:8:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
>>     7 | #include <features.h>
>>   +++ |+#include <stddef.h>
>>     8 |
>> getrandom.c: In function 'rpl_getrandom':
>> getrandom.c:157:10: warning: implicit declaration of function 'getrandom'; did you mean 'rpl_getrandom'? [-Wimplicit-function-declaration]
>>   157 |   return getrandom (buffer, length, flags);
>>       |          ^~~~~~~~~
>>       |          rpl_getrandom
>> getrandom.c:157:10: warning: nested extern declaration of 'getrandom' [-Wnested-externs]
>> make[1]: *** [Makefile:95: getrandom.o] Error 1
>> make[1]: Leaving directory '/var/tmp/portage/app-editors/emacs-28.0.9999/work/emacs/lib'
>> make: *** [Makefile:411: lib] Error 2
>
>
> I don't quite understand what I'm doing but including <stddef.h>
> unconditionally in lib/getrandom.c made Emacs build without any
> (relevant) warnings.