This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [hurd,commited] hurd: do not check Mach and Hurd headers


On Sun, 4 Mar 2018, Samuel Thibault wrote:

> Joseph Myers, on sam. 03 mars 2018 22:53:23 +0000, wrote:
> > I think it's dubious to have a #error requiring _GNU_SOURCE to be used, 
> > because it should always be possible to write a header in a way that 
> > doesn't have such a requirement.  But in any case where, after analysis, 
> > such a #error is found to make sense
> 
> Notably, most Hurd interfaces use the error_t type, which is GNU-only.
> I assume this is enough to make it a #error case?

No.  Create bits/types/error_t.h (which would have a generic version and a 
Hurd version), which would define error_t (subject to __error_t_defined as 
a multiple-include guard).  Then make errno.h include 
<bits/types/error_t.h> if __USE_GNU, while all the Hurd headers using that 
type would include <bits/types/error_t.h> unconditionally.  
(sysdeps/mach/hurd/bits/errno.h would no longer need to define error_t and 
wouldn't need to include <bits/types/error_t.h> either because of errno.h 
doing so - I'm assuming the current reason for defining error_t there is 
simply to get a Hurd-specific definition instead of the default from 
errno.h, which would be dealt with by having a Hurd-specific 
bits/types/error_t.h.)

Having such a bits/types/*.h header is the normal way in glibc of dealing 
with types that different headers need under different conditions.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]