Skip to contentSkip to conversation

config.mk: avoid -traditional-cpp on OS X 10.5

PATCH New Mike Frysinger 3 participants 3 messages Aug 3, 2010 – Aug 8, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5 and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,

                 from test.c:3:

/usr/include/available.h:85: error: stray '#' in program /usr/include/available.h:85: error: syntax error before numeric constant /usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were restricted to Darwin running on PowerPC systems while I'm running on an Intel system. But after some recent clean ups and changes, the flag was being applied to all Darwin systems and my host tools broke.

---
Note: i've only tested Darwin/x86 as my Darwin/ppc is having hardware
trouble atm ... not sure when/if i'll get it fixed

 config.mk |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
config.mk +5 -5
index bcda776..eb95093 100644
@@ -68,13 +68,13 @@ ifeq ($(HOSTOS),darwin)
 DARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
 DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
 
-before-snow-leopard	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le 10 -a \
-	$(DARWIN_MINOR_VERSION) -le 5 ] ; then echo "$(1)"; else echo "$(2)"; fi ;)
+os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
+	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
 
 # Snow Leopards build environment has no longer restrictions as described above
-HOSTCC		 = $(call before-snow-leopard, "cc", "gcc")
-HOSTCFLAGS	+= $(call before-snow-leopard, "-traditional-cpp")
-HOSTLDFLAGS	+= $(call before-snow-leopard, "-multiply_defined suppress")
+HOSTCC		 = $(call os_x_before, 10, 5, "cc", "gcc")
+HOSTCFLAGS	+= $(call os_x_before, 10, 4, "-traditional-cpp")
+HOSTLDFLAGS	+= $(call os_x_before, 10, 5, "-multiply_defined suppress")
 else
 HOSTCC		= gcc
 endif
Signature · 1 line
1.7.2
#1 lore raw

PATCH 1/1 config.mk: avoid -traditional-cpp on OS X 10.5

Dear Mike Frysinger,

i have tested your patch on my old mini running 10.5.8 and it works.

Am 04.08.2010 um 01:17 schrieb Mike Frysinger:

Quoted 31 lines

Simply trying to include a basic header file like stdlib.h on OS X 10.5 and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,

               from test.c:3:

/usr/include/available.h:85: error: stray '#' in program /usr/include/available.h:85: error: syntax error before numeric constant /usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were restricted to Darwin running on PowerPC systems while I'm running on an Intel system. But after some recent clean ups and changes, the flag was being applied to all Darwin systems and my host tools broke.

---
Note: i've only tested Darwin/x86 as my Darwin/ppc is having hardware
trouble atm ... not sure when/if i'll get it fixed

config.mk | 10 +++++-----

1 files changed, 5 insertions(+), 5 deletions(-)
config.mk +0 -2
index bcda776..eb95093 100644
@@ -68,13 +68,13 @@ ifeq ($(HOSTOS),darwin)
 DARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
 DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
 
-before-snow-leopard	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le 10 -a \
-	$(DARWIN_MINOR_VERSION) -le 5 ] ; then echo "$(1)"; else echo "$(2)"; fi ;)

config.mk ifeq ($(HOSTOS),darwin) · line 77

Quoted 10 lines
config.mk +5 -3
+os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
+	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
 
 # Snow Leopards build environment has no longer restrictions as described above
-HOSTCC		 = $(call before-snow-leopard, "cc", "gcc")
-HOSTCFLAGS	+= $(call before-snow-leopard, "-traditional-cpp")
-HOSTLDFLAGS	+= $(call before-snow-leopard, "-multiply_defined suppress")
+HOSTCC		 = $(call os_x_before, 10, 5, "cc", "gcc")
+HOSTCFLAGS	+= $(call os_x_before, 10, 4, "-traditional-cpp")
+HOSTLDFLAGS	+= $(call os_x_before, 10, 5, "-multiply_defined suppress")

I figured out that I can even switch to gcc on that box:

---8<---

$ gcc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--->8---

Therefore your patch could be simplified by switching from 'before-snow-leopard' to 'before-leopard' logic. Nevertheless i like the os_x_before macro more than the first solution.

regards

Andreas Bie?mann

#2 lore raw

PATCH 1/1 config.mk: avoid -traditional-cpp on OS X 10.5

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 13 lines · In message <[email protected]> you wrote:

Simply trying to include a basic header file like stdlib.h on OS X 10.5 and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,

                 from test.c:3:

/usr/include/available.h:85: error: stray '#' in program /usr/include/available.h:85: error: syntax error before numeric constant /usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were restricted to Darwin running on PowerPC systems while I'm running on an Intel system. But after some recent clean ups and changes, the flag was being applied to all Darwin systems and my host tools broke.

Quoted 7 lines

---
Note: i've only tested Darwin/x86 as my Darwin/ppc is having hardware
trouble atm ... not sure when/if i'll get it fixed

 config.mk |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any sufficiently advanced technology is indistinguishable from magic.
Clarke's Third Law       - _Profiles of the Future_ (1962; rev. 1973)
                  ``Hazards of Prophecy: The Failure of Imagination''