All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix build failure on cygwin.
@ 2012-04-02 14:05 Andrej Krutak
  2012-04-02 21:31 ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Krutak @ 2012-04-02 14:05 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Andrej Krutak

The _B macro is defined by cygwin in ctype.h.
Move the inclusion to avoid build failure.

Signed-off-by: Andrej Krutak <andree@andree.sk>
---
 scripts/dtc/dtc.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
index f37c97e..7aa3cc6 100644
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -27,13 +27,13 @@
 #include <stdint.h>
 #include <stdarg.h>
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
 
 #include <libfdt_env.h>
 #include <fdt.h>
 
+#include <ctype.h>
 #include "util.h"
 
 #ifdef DEBUG
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix build failure on cygwin.
  2012-04-02 14:05 [PATCH] Fix build failure on cygwin Andrej Krutak
@ 2012-04-02 21:31 ` Michal Marek
  2012-04-02 22:22   ` Jon Loeliger
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2012-04-02 21:31 UTC (permalink / raw)
  To: Andrej Krutak; +Cc: linux-kbuild, Jon Loeliger

Adding Jon Loeliger (dtc maintainer) to CC.


Dne 2.4.2012 16:05, Andrej Krutak napsal(a):
> The _B macro is defined by cygwin in ctype.h.
> Move the inclusion to avoid build failure.

But nothing prevents the other system headers from including <ctype.h>
earlier :-(. A more robust fix would be to rename the macro to something
that does not clash (fdt_b??). But that's up to Jon.

Michal

> 
> Signed-off-by: Andrej Krutak <andree@andree.sk>
> ---
>  scripts/dtc/dtc.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
> index f37c97e..7aa3cc6 100644
> --- a/scripts/dtc/dtc.h
> +++ b/scripts/dtc/dtc.h
> @@ -27,13 +27,13 @@
>  #include <stdint.h>
>  #include <stdarg.h>
>  #include <assert.h>
> -#include <ctype.h>
>  #include <errno.h>
>  #include <unistd.h>
>  
>  #include <libfdt_env.h>
>  #include <fdt.h>
>  
> +#include <ctype.h>
>  #include "util.h"
>  
>  #ifdef DEBUG


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix build failure on cygwin.
  2012-04-02 21:31 ` Michal Marek
@ 2012-04-02 22:22   ` Jon Loeliger
  2012-04-03  6:35     ` [PATCH] Rename _B to _XBYTE in libfdt_env.h Andrej Krutak
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Loeliger @ 2012-04-02 22:22 UTC (permalink / raw)
  To: Michal Marek; +Cc: Andrej Krutak, linux-kbuild

> Adding Jon Loeliger (dtc maintainer) to CC.
> 
> Dne 2.4.2012 16:05, Andrej Krutak napsal(a):
> > The _B macro is defined by cygwin in ctype.h.
> > Move the inclusion to avoid build failure.
> 
> But nothing prevents the other system headers from including <ctype.h>
> earlier :-(. A more robust fix would be to rename the macro to something
> that does not clash (fdt_b??). But that's up to Jon.
> 
> Michal

Folks,

I'll happily accept a patch to rename _B() to something better
or eliminate it entirely.  Patch to devtree-discuss@lists.ozlabs.org
and CC:'ed to jdl@jdl.com, please.

Thanks,
jdl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Rename _B to _XBYTE in libfdt_env.h.
  2012-04-02 22:22   ` Jon Loeliger
@ 2012-04-03  6:35     ` Andrej Krutak
  2012-04-09 13:49       ` Jon Loeliger
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Krutak @ 2012-04-03  6:35 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: devtree-discuss, Michal Marek, linux-kbuild, Andrej Krutak

The _B macro is also defined by cygwin in ctype.h.
Rename _B to _XBYTE to better avoid name collisions.

Signed-off-by: Andrej Krutak <andree@andree.sk>
---
 scripts/dtc/libfdt/libfdt_env.h |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h
index 449bf60..4ec8565 100644
--- a/scripts/dtc/libfdt/libfdt_env.h
+++ b/scripts/dtc/libfdt/libfdt_env.h
@@ -5,19 +5,20 @@
 #include <stdint.h>
 #include <string.h>
 
-#define _B(n)	((unsigned long long)((uint8_t *)&x)[n])
+#define _XBYTE(n)	((unsigned long long)((uint8_t *)&x)[n])
 static inline uint32_t fdt32_to_cpu(uint32_t x)
 {
-	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
+	return (_XBYTE(0) << 24) | (_XBYTE(1) << 16) | (_XBYTE(2) << 8) | _XBYTE(3);
 }
 #define cpu_to_fdt32(x) fdt32_to_cpu(x)
 
 static inline uint64_t fdt64_to_cpu(uint64_t x)
 {
-	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
-		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
+	return (_XBYTE(0) << 56) | (_XBYTE(1) << 48) | (_XBYTE(2) << 40)
+		| (_XBYTE(3) << 32) | (_XBYTE(4) << 24) | (_XBYTE(5) << 16)
+		| (_XBYTE(6) << 8) | _XBYTE(7);
 }
 #define cpu_to_fdt64(x) fdt64_to_cpu(x)
-#undef _B
+#undef _XBYTE
 
 #endif /* _LIBFDT_ENV_H */
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Rename _B to _XBYTE in libfdt_env.h.
  2012-04-03  6:35     ` [PATCH] Rename _B to _XBYTE in libfdt_env.h Andrej Krutak
@ 2012-04-09 13:49       ` Jon Loeliger
  0 siblings, 0 replies; 5+ messages in thread
From: Jon Loeliger @ 2012-04-09 13:49 UTC (permalink / raw)
  To: Andrej Krutak; +Cc: devtree-discuss, Michal Marek, linux-kbuild

> The _B macro is also defined by cygwin in ctype.h.
> Rename _B to _XBYTE to better avoid name collisions.
> 
> Signed-off-by: Andrej Krutak <andree@andree.sk>
> ---
>  scripts/dtc/libfdt/libfdt_env.h |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h
> index 449bf60..4ec8565 100644
> --- a/scripts/dtc/libfdt/libfdt_env.h
> +++ b/scripts/dtc/libfdt/libfdt_env.h

This patch is against the kernel _copy_ of the DTC sources.
Technically, we'll need it against the upstream sources
as found here:

    git://git.jdl.com/software/dtc.git

Later, the patch will appear in the kernel when it updates
with a newer source drop.

Thanks,
jdl

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-09 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-02 14:05 [PATCH] Fix build failure on cygwin Andrej Krutak
2012-04-02 21:31 ` Michal Marek
2012-04-02 22:22   ` Jon Loeliger
2012-04-03  6:35     ` [PATCH] Rename _B to _XBYTE in libfdt_env.h Andrej Krutak
2012-04-09 13:49       ` Jon Loeliger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.