http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50777

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-10-18
                 CC|                            |bonzini at gnu dot org, ian
                   |                            |at airs dot com
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1

--- Comment #2 from Rainer Orth <ro at gcc dot gnu.org> 2011-10-18 16:09:06 UTC 
---
They are, via system.h.  The problem is twofold:

* madvise(3) is declared in <sys/mman.h> conditionally: in the Solaris 10
  version of the header, we have:

#ifdef    __STDC__
#if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
...
#else    /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
...
extern int madvise(caddr_t, size_t, int)...
...
#endif    /* (_POSIX_C_SOURCE > 2)  || defined(_XPG4_2) */

* configure uses the C compiler to detect support for madvise() and finds it,
  while the actual compilation happens with g++, which defines
_XOPEN_SOURCE=600,
  among others, which hides the declaration.

In Solaris 11, there's no issue AFAICS since with __EXTENSIONS__ defined (which
configure takes care of), the madivse() prototype is visible.  I'm currently
running a bootstrap to verify this.

There are two options:

* Actually perform the configure tests with the compiler to be used (g++)
instead
  of gcc.  Everything else is bound to yield bogus results once in a while, or
  at least do so for madvise.

* Hack around this with fixincludes, but in this case I'd consider this a bug
  by itself.

Paolo, Ian, suggestions?

  Rainer

Reply via email to