https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69881
--- Comment #21 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to Jonathan Wakely from comment #20) > (In reply to Bernd Edlinger from comment #19) > > But I am sure that #define __need_offsetof can simply not work. > > So don't define that. It's undefined behaviour. > hmmm... I am not sure it I tried to ride on a dead horse here... Maybe I should just leave the c/* and c_std/* headers as they are. I should just leave the attachment here, if some one has use for c_std/* headers. > > I am not sure if it can compile at all, because if I try > > there are the same bogus symlinks to missing c/-headers. > > > > But before the build reaches the point where that matters, > > the cstdlib simply includes <stdlib.h> which fails to declare > > std::abort. > > > > Is this c/cstdlib intended for targets that have C++ aware stdlib.h? > > Yes. > > > When we leave it as it is, everyone will point with the finger > > on us, because it looks like a gcc-bug. > > > > Alternative would be to detect that any of the 6 known > > __need_-defines are present when invoking cstddef and > > give an explicit #error, but this mis-use worked previously. > > Or maybe a #warning would be a compromise? > > > > What do you think? > > I think if we do anything then I prefer your original suggestion to just > #undef them. > > But I'm not yet convinced we should do anything. This already failed with > old versions of GCC: > > // get size_t > #define __need_size_t > #include <cstddef> > // get everything else > #include <cstddef> > std::max_align_t m; Yes, but I don't know how often I've boot-strapped gcc-4.9 already and I never noticed anything of that undefined behaviour until now. The problem is that header A can define __need_size_t, and include the wrong system header file. That leaks into header B which includes <cstddef> and now we get a cryptic error, while previously we just did not have the std::max_align_t, which is also bad, if you need it but if you don't need it, you will never know. BTW: we have a similar problem with cstdarg: #define __need___va_list #include <cstdarg> fails to compile. and c/cstdarg has: #undef __need___va_list #include_next <stdarg.h> I would like to add this to c_global/cstdarg: #pragma GCC system_header +#ifdef __need___va_list +#warning __need___va_list is not supported in cstdarg +#undef __need___va_list +#endif #include <bits/c++config.h> #include <stdarg.h> that would be rather comfortable for the user.