NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/54362: Older upstream gcc don't provide size_t any longer due to ansi.h cleanup



>Number:         54362
>Category:       toolchain
>Synopsis:       Older upstream gcc don't provide size_t any longer due to ansi.h cleanup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 09 12:00:00 +0000 2019
>Originator:     Tobias Ulmer
>Release:        NetBSD 8.99.50
>Organization:
>Environment:
NetBSD phenom.tmux.org 8.99.50 NetBSD 8.99.50 (GENERIC_DEBUG) #4: Sun Jul  7 01:57:40 CEST 2019  tobiasu@sun:/home/tobiasu/netbsd/src/sys/arch/amd64/compile/obj.amd64/GENERIC_DEBUG amd64
>Description:
All upstream gcc lack size_t, wchar_t and ptrdiff_t typedefs despite #include <stddef.h> under the following conditions:

a) gcc's internal stddef.h is unpatched and older than this commit upstreamed by Maya on Jun 20, 2018:
https://github.com/gcc-mirror/gcc/commit/c7af124dca795b835d7fda24192b9e4849f1bb08#diff-a11d20ec50407db862e6c32cbbdb6bc5

b) NetBSD is new enough to include the ansi.h cleanup by Kamil from 2019/05/07:
https://github.com/NetBSD/src/commit/fa04e607407a6cb5563feb93b3a19bd8f7f37981#diff-06b1219e9b8f10544f55a73a11e4895a


This affects both building sources with an already existing binary compiler, as well as building gcc itself.

For example this takes out the bootstrap compiler used by lang/gcc5-aux as well as
failing during compilation once the bootstrap compiler has been fixed in some way.


Obviously this is because of the insanity that is gcc's internal stddef.h
>How-To-Repeat:
echo "#include <stddef.h>" | WRKOBJDIR/lang/gcc5-aux/work/bootstrap/bin/gcc -E - | grep size_t


Demonstrating one possible fix:
echo "#include <stddef.h>" | WRKOBJDIR/lang/gcc5-aux/work/bootstrap/bin/gcc -D_ANSI_H_ -E - | grep size_t
>Fix:
Staring at gcc's stddef.h until I got sick, it seems the cleanest way is
to define _ANSI_H_ in sys/sys/common_ansi.h until gcc < 9.1 is truly forgotten.

#ifndef _ANSI_H_
/* See PR blah why you should not delete this pointless header guard */
#define _ANSI_H_
#endif

This should work on all archs (ia64 still defines it:
https://github.com/NetBSD/src/blob/trunk/sys/arch/ia64/include/ansi.h),
and optionally allows the removal of patches like /usr/pkgsrc/lang/gcc8/patches/patch-gcc_ginclude_stddef.h

With the above change gcc5-aux builds again.



Home | Main Index | Thread Index | Old Index