Fixed build failure on Linux in cppfiles (_XOPEN_SOURCEis evil)

Mark Mitchell mark@codesourcery.com
Sat Sep 16 10:49:00 GMT 2000


>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:

    >> Defining these macros unconditionally on all systems is a
    >> mistake.

    Alexandre> Agreed.  I just approved the patch to get the tree in a
    Alexandre> buildable state again, at least on GNU/Linux.

OK, I'm glad you agree.

    Alexandre> I think we could leave the tree as is for the next
    Alexandre> snapshot and see what breaks, then decide our next
    Alexandre> step.

In general, when we leave something be, we don't come back to it.

  Maybe the way to go is to define _XOPEN_SOURCE conditionally and, if
  it is defined, to decide whether to define _BSD_SOURCE and _GNU_SOURCE
  too.

I'm not sure I quite understand, but that sounds like it could be
sensible.  

I think there are two plausible strategies:

  - Experimentally determine which of these macros are needed.

    This is analagous to trying the inclusion of several different
    header files hoping to get a declaration of some function foo,
    where different systems put it in different header files.

  - Notice that we are using glibc, or particular versions of glibc,
    and turn on the defines there, since we know what they will do.

Otherwise, we're unconditionally defining macros that could have
affects we don't understand, and that we don't even have evidence will
help us.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


More information about the Gcc-patches mailing list