git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [RFC/PATCH 1/2] Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6
Date: Thu, 28 May 2009 13:37:09 -0700	[thread overview]
Message-ID: <7viqjlge16.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <WLNdjYtfqcg2bT6yOBtAykIqOBTeSLRUdlB6-sTM2KzTjwOmzN3fLg@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Thu\, 28 May 2009 11\:46\:50 -0500")

Brandon Casey <casey@nrlssc.navy.mil> writes:

> So we either require compiling with a c99 compiler (by ensuring that
> _XPG6 is set) or exclude compiling with a c99 compiler on sun (by
> ensuring that _XPG6 is not set).  Actually, this would only affect Solaris
> versions which support XPG6.  Solaris 11 and 10 do.  I don't know about
> Solaris 9 and 8.  Solaris 7 doesn't.
>
> Which do we want to do?

If possible, both ;-), because people would have or want to use different
compilers.

I use "gcc -std=c99" on all platforms I compile git on (for details see
"Make" in the 'todo' branch; I have a checkout of the todo branch at Meta/
and say "Meta/Make --pedantic" from the toplevel), and that is how I
noticed this breakage on OpenSolaris 08.11 (it identifies itself as 5.11,
so presumably it falls into "Solaris 11" category you cited above?)

>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index c7cf2d5..4236647 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -41,8 +41,10 @@
>>  
>>  #if !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
>>  #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */

Judging from their header files, I guess Sun's attitude is incompatible
with the above comment for _XOPEN_SOURCE.  We say "... need 500" and set
it to 600 because we merely mean "need to be at least 500" by "need 500",
but Sun wants us to be very precise.  So instead of saying __sun__, we
could do something more explicit with a huge comment...

	#if !defined(__APPLE__) ...
        # define _XOPEN_SOURCE 600
        /*
         * On Solaris, when _XOPEN_EXTENDED is set, its header file
         * forces the programs to be XPG4v2, defeating the _XOPEN_SOURCE
         * setting we just made to say we are XPG6.  Also on Solaris,
         * XPG6 programs must be compiled with a c99 compiler, while
         * non XPG6 programs must be compiled with a pre-c99 compiler.
         */
        # if defined(__sun__) && !(__STDC_VERSION__ - 0 >= 199901L)
        # define _XOPEN_EXTENDED 1 /* AIX 5.3L wants this */
        # endif
	#endif

We might want to flatten this a bit more to special case Solaris, which
might make it easier to maintain, e.g.

	#if defined(__sun__)
        # ... whatever _XOPEN_SOURCE and _XOPEN_EXTENDED magic
        # ... Solaris wants
        #elif !defined(__APPLE__) && ...
        # ... existing code
        #endif

  parent reply	other threads:[~2009-05-28 20:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-23 19:24 [RFC/PATCH 0/2] OpenSolaris 2008.11 portability fixes Junio C Hamano
2009-05-23 19:24 ` [RFC/PATCH 1/2] Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6 Junio C Hamano
2009-05-23 19:24   ` [RFC/PATCH 2/2] OpenSolaris 200811 (SunOS 5.11) does not want OLD_ICONV Junio C Hamano
2009-05-28 16:46   ` [RFC/PATCH 1/2] Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6 Brandon Casey
2009-05-28 19:19     ` Jeff King
2009-05-28 19:40       ` Brandon Casey
2009-05-28 19:50         ` Jeff King
2009-05-28 20:37     ` Junio C Hamano [this message]
2009-06-11 15:06   ` Tomas Carnecky
2009-06-11 15:50     ` Brandon Casey
2009-06-11 16:42       ` Tomas Carnecky
2009-06-11 17:13         ` Brandon Casey
2009-06-11 17:36           ` Tomas Carnecky
2009-06-11 17:42             ` Brandon Casey
2009-06-11 15:58     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7viqjlge16.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).