Skip to contentSkip to conversation

dts/Makefile: Turn off system-/gcc-specific predefined macros

PATCH Superseded Horst Kronstorfer 4 participants 11 messages Jul 13, 2012 – Aug 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

With '-undef' in place only the standard predefined macros are visible:

 $ gcc -dM -E -undef - </dev/null
 #define __STDC_HOSTED__ 1
 #define __STDC__ 1
---
 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dts/Makefile +1 -1
index 402dfe1..3c6bc18 100644
@@ -36,7 +36,7 @@ $(error Your architecture does not have device tree support enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
 # We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
+DTS_CPPFLAGS := -undef -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
 
 all:	$(obj).depend $(LIB)
 
Signature · 1 line
1.7.11.2
#1 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 6 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

i think you should use -ansi instead. that's what we use in other places for the same reason.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120718/7ca93baf/attachment.pgp>

#2 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Quoted 8 lines
Quoted 3 lines

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

i think you should use -ansi instead. that's what we use in other places for the same reason.
-mike

this would increase the probability of a name clash.

-h

Quoted 7 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#3 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 5 lines · On Tuesday 24 July 2012 06:11:04 Horst Kronstorfer wrote:
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

i think you should use -ansi instead. that's what we use in other places for the same reason.

this would increase the probability of a name clash.

no idea what you're talking about. have you actually looked at the output of gcc -E -dD -ansi ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120724/a16a7581/attachment.pgp>

#4 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Tuesday 24 July 2012 06:11:04 Horst Kronstorfer wrote:
Quoted 8 lines · Mike Frysinger
Quoted 6 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

i think you should use -ansi instead. that's what we use in other places for the same reason.

this would increase the probability of a name clash.

no idea what you're talking about. have you actually looked at the output of gcc -E -dD -ansi ?

$ gcc -E -dM -ansi - </dev/null | wc -l
229
$ gcc -E -dM -undef - </dev/null | wc -l
2

-h

Quoted 2 lines

-mike

#5 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 18 lines · On Tuesday 24 July 2012 15:38:55 Horst Kronstorfer wrote:
Quoted 17 lines · Mike Frysinger
Quoted 15 lines · On Tuesday 24 July 2012 06:11:04 Horst Kronstorfer wrote:
Quoted 5 lines · Mike Frysinger
Quoted 4 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Quoted 7 lines
Quoted 4 lines

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

i think you should use -ansi instead. that's what we use in other places for the same reason.

this would increase the probability of a name clash.

Quoted 7 lines
Quoted 2 lines

no idea what you're talking about. have you actually looked at the output of gcc -E -dD -ansi ?

$ gcc -E -dM -ansi - </dev/null | wc -l
229
$ gcc -E -dM -undef - </dev/null | wc -l
2

and ? did you *look* at the output ? they're all of the form __foo__. do any device trees really use __foo__ names ? i don't think so.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120725/02a800f0/attachment.pgp>

#6 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 22 lines · Mike Frysinger
Quoted 21 lines · On Tuesday 24 July 2012 15:38:55 Horst Kronstorfer wrote:
Quoted 19 lines · Mike Frysinger
Quoted 11 lines · On Tuesday 24 July 2012 06:11:04 Horst Kronstorfer wrote:
Quoted 10 lines · Mike Frysinger
Quoted 8 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

Quoted 4 lines
Quoted 2 lines

i think you should use -ansi instead. that's what we use in other places for the same reason.

this would increase the probability of a name clash.

no idea what you're talking about. have you actually looked at the output of gcc -E -dD -ansi ?

Quoted 6 lines
Quoted 4 lines
$ gcc -E -dM -ansi - </dev/null | wc -l
229
$ gcc -E -dM -undef - </dev/null | wc -l
2

and ? did you *look* at the output ? they're all of the form __foo__.

i already considered that.

Quoted 1 line

do any device trees really use __foo__ names ? i don't think so.

is there any drawback using '-undef' in this particular case besides "we use -ansi in other places for the same reason"?

-h

Quoted 2 lines

-mike

#7 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

Quoted 28 lines · On Thursday 26 July 2012 03:06:06 Horst Kronstorfer wrote:
Quoted 27 lines · Mike Frysinger
Quoted 25 lines · On Tuesday 24 July 2012 15:38:55 Horst Kronstorfer wrote:
Quoted 12 lines · Mike Frysinger
Quoted 11 lines · On Tuesday 24 July 2012 06:11:04 Horst Kronstorfer wrote:
Quoted 10 lines · Mike Frysinger
Quoted 8 lines · On Friday 13 July 2012 09:03:40 Horst Kronstorfer wrote:

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

i think you should use -ansi instead. that's what we use in other places for the same reason.

this would increase the probability of a name clash.

no idea what you're talking about. have you actually looked at the output of gcc -E -dD -ansi ?

$ gcc -E -dM -ansi - </dev/null | wc -l
229
$ gcc -E -dM -undef - </dev/null | wc -l
2
Quoted 8 lines
Quoted 1 line

and ? did you *look* at the output ? they're all of the form __foo__.

i already considered that.

Quoted 1 line

do any device trees really use __foo__ names ? i don't think so.

is there any drawback using '-undef' in this particular case besides "we use -ansi in other places for the same reason"?

we use -ansi because it's more portable and has known behavior in the build system
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120726/1480d2fb/attachment.pgp>

#8 lore raw

PATCH v2 1/1 dts/Makefile: Turn off some predefined macros

In reply to Horst Kronstorfer

Add '-ansi' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches some predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-ansi') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

---
Changes in v2:
- Use '-ansi' instead of '-undef.'

 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dts/Makefile +1 -1
index 402dfe1..3c6bc18 100644
@@ -36,7 +36,7 @@ $(error Your architecture does not have device tree support enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
 # We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
+DTS_CPPFLAGS := -ansi -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
 
 all:	$(obj).depend $(LIB)
 
Signature · 1 line
1.7.11.2
#9 lore raw

PATCH v2 1/1 dts/Makefile: Turn off some predefined macros

Dear Horst Kronstorfer,

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

Add '-ansi' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches some predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-ansi') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

Quoted 7 lines

---
Changes in v2:
- Use '-ansi' instead of '-undef.'

 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied this one instead, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
Overflow on /dev/null, please empty the bit bucket.
#10 lore raw

PATCH 1/1 dts/Makefile: Turn off system-/gcc-specific predefined macros

In reply to Horst Kronstorfer

Dear Horst Kronstorfer,

Quoted 9 lines · In message <[email protected]> you…

Add '-undef' to DTS_CPPFLAGS to avoid unwanted expansion of dts content that matches system-specific or gcc-specific predefined macros.

Example: A number of PowerPC related *.dts files in the kernel define a property named 'linux,network-index' which (w/o '-undef') is expanded to '1,network-index' by the preprocessor because of '#define linux 1.'

With '-undef' in place only the standard predefined macros are visible:

Quoted 8 lines
 $ gcc -dM -E -undef - </dev/null
 #define __STDC_HOSTED__ 1
 #define __STDC__ 1
---
 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
I object to intellect without discipline;  I object to power without
constructive purpose.
	-- Spock, "The Squire of Gothos", stardate 2124.5