linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marko Kreen" <markokr@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: [patch] Mac OS X specs for cgcc
Date: Thu, 20 Dec 2007 15:50:00 +0200	[thread overview]
Message-ID: <e51f66da0712200550l620838f5h727b711a3abb85a@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

This patch adds MacOS X (darwin) specific defines to cgcc.

Only suspicios aspect about it is that OSX system include
files expect either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to be
defined to show endianess.  I added a arch switch to darwin
section to pick this up to avoid polluting general i86 and x86_64
sections.  (note: i dont speak perl and i dont have any ppc32/64
to test it on).

Somwhat simpler would be to put __LITTLE_ENDIAN__ unconditionally
to darwin section on the grounds that ppc is unsupported anyway,
but if the support appears it may be better to have the switch
available already.

-- 
marko

[-- Attachment #2: cgcc.macos.specs.diff --]
[-- Type: application/octet-stream, Size: 606 bytes --]

diff --git a/cgcc b/cgcc
index 9acf498..d4c50f8 100755
--- a/cgcc
+++ b/cgcc
@@ -214,6 +214,14 @@ sub add_specs {
     } elsif ($spec eq 'linux') {
 	return &add_specs ('unix') .
 	    ' -D__linux__=1 -D__linux=1 -Dlinux=linux';
+    } elsif ($spec eq 'darwin') {
+	my $osx = ' -D__MACH__=1 -D__APPLE__=1 -D__APPLE_CC__=1 -D__DYNAMIC__=1';
+	my $arch = `uname -m`;
+	if ($arch =~ /ppc/i) {
+	  return ($osx . " -D__BIG_ENDIAN__");
+	} else {
+	  return ($osx . " -D__LITTLE_ENDIAN__");
+	}
     } elsif ($spec eq 'unix') {
 	return ' -Dunix=1 -D__unix=1 -D__unix__=1';
     } elsif ( $spec =~ /^cygwin/) {

                 reply	other threads:[~2007-12-20 13:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=e51f66da0712200550l620838f5h727b711a3abb85a@mail.gmail.com \
    --to=markokr@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).