glibc/sysdeps/s390/multiarch
Joseph Myers 6900d2ca74 Fix s390 -Os iconv build.
Building glibc for s390 with -Os (32-bit only, with GCC 7) fails with:

In file included from ../sysdeps/s390/multiarch/8bit-generic.c:370:0,
                 from ebcdic-at-de.c:28:
../iconv/loop.c: In function '__to_generic_vx':
../iconv/loop.c:264:22: error: 'ch' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (((Character) >> 7) == (0xe0000 >> 7))          \
                      ^~
In file included from ebcdic-at-de.c:28:0:
../sysdeps/s390/multiarch/8bit-generic.c:340:15: note: 'ch' was declared here
      uint32_t ch;      \
               ^
../iconv/loop.c:325:7: note: in expansion of macro 'BODY'
       BODY
       ^~~~

It's fairly easy to see, looking at the (long) expansion of the BODY
macro, that this is a false positive and the relevant variable 'ch' is
always initialized before use, in one of two possible places.  As
such, disabling the warning for -Os with the DIAG_* macros is the
natural approach to fix this build failure.  However, because of the
location at which the warning is reported, the disabling needs to go
in iconv/loop.c, around the definition of UNICODE_TAG_HANDLER (not
inside the definition), as that macro definition is where the
uninitialized use is reported, whereas the code that needs to be
reasoned about to see that the warning is a false positive is in the
definition of BODY elsewhere.

Thus, the patch adds such disabling in iconv/loop.c, with a comment
pointing to the s390-specific code and a comment in the s390-specific
code pointing to the generic file to alert people to the possible need
to update one place when changing the other.  It would be possible if
desired to use #ifdef __s390__ around the disabling, though in general
we try to avoid that sort of thing in generic files.  (Or some
extremely specialized macros for "disable -Wmaybe-uninitialized in
this particular place" could be specified, defined to 0 in a lot of
different files that include iconv/loop.c and to 1 in that particular
s390 file.)

Tested that this fixed -Os compilation for s390-linux-gnu with
build-many-glibcs.py.

	* iconv/loop.c (UNICODE_TAG_HANDLER): Disable
	-Wmaybe-uninitialized for -Os.
	* sysdeps/s390/multiarch/8bit-generic.c (BODY): Add comment about
	this disabling.
2018-03-05 21:46:55 +00:00
..
iconv
8bit-generic.c
gconv_simple.c
gen-8bit.sh
ifunc-impl-list.c
ifunc-resolve.h
Makefile
memccpy-c.c
memccpy-vx.S
memccpy.c
memchr-vx.S
memchr.c
mempcpy.c
memrchr-c.c
memrchr-vx.S
memrchr.c
rawmemchr-c.c
rawmemchr-vx.S
rawmemchr.c
stpcpy-c.c
stpcpy-vx.S
stpcpy.c
stpncpy-c.c
stpncpy-vx.S
stpncpy.c
strcat-c.c
strcat-vx.S
strcat.c
strchr-c.c
strchr-vx.S
strchr.c
strchrnul-c.c
strchrnul-vx.S
strchrnul.c
strcmp-vx.S
strcmp.c
strcpy-vx.S
strcpy.c
strcspn-c.c
strcspn-vx.S
strcspn.c
strlen-c.c
strlen-vx.S
strlen.c
strncat-c.c
strncat-vx.S
strncat.c
strncmp-c.c
strncmp-vx.S
strncmp.c
strncpy-vx.S
strncpy.c
strnlen-c.c
strnlen-vx.S
strnlen.c
strpbrk-c.c
strpbrk-vx.S
strpbrk.c
strrchr-c.c
strrchr-vx.S
strrchr.c
strspn-c.c
strspn-vx.S
strspn.c
utf8-utf16-z9.c
utf8-utf32-z9.c
utf16-utf32-z9.c
wcpcpy-c.c
wcpcpy-vx.S
wcpcpy.c
wcpncpy-c.c
wcpncpy-vx.S
wcpncpy.c
wcscat-c.c
wcscat-vx.S
wcscat.c
wcschr-c.c
wcschr-vx.S
wcschr.c
wcschrnul-c.c
wcschrnul-vx.S
wcschrnul.c
wcscmp-c.c
wcscmp-vx.S
wcscmp.c
wcscpy-c.c
wcscpy-vx.S
wcscpy.c
wcscspn-c.c
wcscspn-vx.S
wcscspn.c
wcslen-c.c
wcslen-vx.S
wcslen.c
wcsncat-c.c
wcsncat-vx.S
wcsncat.c
wcsncmp-c.c
wcsncmp-vx.S
wcsncmp.c
wcsncpy-c.c
wcsncpy-vx.S
wcsncpy.c
wcsnlen-c.c
wcsnlen-vx.S
wcsnlen.c
wcspbrk-c.c
wcspbrk-vx.S
wcspbrk.c
wcsrchr-c.c
wcsrchr-vx.S
wcsrchr.c
wcsspn-c.c
wcsspn-vx.S
wcsspn.c
wmemchr-c.c
wmemchr-vx.S
wmemchr.c
wmemcmp-c.c
wmemcmp-vx.S
wmemcmp.c
wmemset-c.c
wmemset-vx.S
wmemset.c