This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Fixed build failure on Linux in cppfiles (_XOPEN_SOURCEis evil)


>>>>> "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

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