diff mbox series

libfdt: include "..." instead of <...> from libfdt.h

Message ID 1520172484-26867-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series libfdt: include "..." instead of <...> from libfdt.h | expand

Commit Message

Masahiro Yamada March 4, 2018, 2:08 p.m. UTC
Assuming fdt.h, libfdt.h, and libfdt_env.h will be installed to the
same directory, it wouldn't hurt to use #include "..." for inclusion
among installed headers.

This change is useful for cases where those headers do not reside in
the header search paths.

For example, Linux kernel edits these two lines when importing libfdt
(see scripts/dtc/update-dtc-source.sh)  It is needed for kernel because
include/linux/libfdt.h is a wrapper of scripts/dtc/libfdt/libfdt.h, and
scripts/dtc/libfdt is not contained in the header search paths.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 libfdt/libfdt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Gibson March 7, 2018, 2:39 a.m. UTC | #1
On Sun, Mar 04, 2018 at 11:08:04PM +0900, Masahiro Yamada wrote:
> Assuming fdt.h, libfdt.h, and libfdt_env.h will be installed to the

> same directory,


That's very likely for fdt.h and libfdt.h, but not so much for
libfdt_env.h.  libfdt is designed so that libfdt_env.h can be replaced
with something suitable for embedding in a different environment, and
in that case it's often inconvenient to put libfdt_env.h in the same
directory (because then it wouldn't be an exact copy of dtc upstream).

> it wouldn't hurt to use #include "..." for inclusion

> among installed headers.

> 

> This change is useful for cases where those headers do not reside in

> the header search paths.


The general idea has been that to compile libfdt you should set your
header search paths to something suitable.  What situations does that
become difficult or impossible in?

> For example, Linux kernel edits these two lines when importing libfdt

> (see scripts/dtc/update-dtc-source.sh)  It is needed for kernel because

> include/linux/libfdt.h is a wrapper of scripts/dtc/libfdt/libfdt.h, and

> scripts/dtc/libfdt is not contained in the header search paths.


Oh, yuck.  I hadn't realised the kernel was using such a gross hack.
We need to find a better way, but I'm not certain if this is it.

> 

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---

> 

>  libfdt/libfdt.h | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h

> index c8c00fa..1e27780 100644

> --- a/libfdt/libfdt.h

> +++ b/libfdt/libfdt.h

> @@ -51,8 +51,8 @@

>   *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

>   */

>  

> -#include <libfdt_env.h>

> -#include <fdt.h>

> +#include "libfdt_env.h"

> +#include "fdt.h"

>  

>  #define FDT_FIRST_SUPPORTED_VERSION	0x02

>  #define FDT_LAST_SUPPORTED_VERSION	0x11


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
diff mbox series

Patch

diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
index c8c00fa..1e27780 100644
--- a/libfdt/libfdt.h
+++ b/libfdt/libfdt.h
@@ -51,8 +51,8 @@ 
  *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <libfdt_env.h>
-#include <fdt.h>
+#include "libfdt_env.h"
+#include "fdt.h"
 
 #define FDT_FIRST_SUPPORTED_VERSION	0x02
 #define FDT_LAST_SUPPORTED_VERSION	0x11