[06/25] move platform depended include into system.h of libebl

Message ID 20221020182603.815-7-luoyonggang@gmail.com
State Changes Requested
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Oct. 20, 2022, 6:25 p.m. UTC
  Because all source in libebl #include <libeblP.h>, so #include <system.h> in
libeblP.h is enough, there is multiple memory-access.h file, so use relative path to
include it properly,

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
---
 libebl/eblauxvinfo.c        |  3 +--
 libebl/eblcorenote.c        |  3 +--
 libebl/ebldynamictagname.c  |  2 +-
 libebl/eblobjnote.c         | 10 +++++-----
 libebl/eblobjnotetypename.c |  3 +--
 libebl/eblopenbackend.c     |  4 ++--
 libebl/eblresolvesym.c      |  3 ++-
 libebl/libeblP.h            |  4 +++-
 8 files changed, 16 insertions(+), 16 deletions(-)
  

Comments

Mark Wielaard Oct. 28, 2022, 11:35 a.m. UTC | #1
Unaddressed
On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
wrote:
> Because all source in libebl #include <libeblP.h>, so #include
> <system.h> in
> libeblP.h is enough, there is multiple memory-access.h file, so use
> relative path to
> include it properly,

I am not a fan of the relative path trick, especially if there it is
clear only one is every needed. You also use it for other files, why?

Cheers,

Mark
  

Patch

diff --git a/libebl/eblauxvinfo.c b/libebl/eblauxvinfo.c
index ce1141b8..36554693 100644
--- a/libebl/eblauxvinfo.c
+++ b/libebl/eblauxvinfo.c
@@ -31,11 +31,10 @@ 
 #endif
 
 #include <assert.h>
-#include <byteswap.h>
-#include <endian.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stddef.h>
+
 #include <libeblP.h>
 
 #define AUXV_TYPES							      \
diff --git a/libebl/eblcorenote.c b/libebl/eblcorenote.c
index 7fab3974..9573e93e 100644
--- a/libebl/eblcorenote.c
+++ b/libebl/eblcorenote.c
@@ -31,12 +31,11 @@ 
 #endif
 
 #include <assert.h>
-#include <byteswap.h>
-#include <endian.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <string.h>
+
 #include <libeblP.h>
 
 
diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c
index 5d4a3a58..018a2ff7 100644
--- a/libebl/ebldynamictagname.c
+++ b/libebl/ebldynamictagname.c
@@ -33,8 +33,8 @@ 
 
 #include <inttypes.h>
 #include <stdio.h>
+
 #include <libeblP.h>
-#include "system.h"
 
 
 const char *
diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index 5a7c5c62..83ac4f47 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -35,13 +35,13 @@ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <libeblP.h>
 
-#include "common.h"
-#include "libelfP.h"
-#include "libdwP.h"
-#include "memory-access.h"
+#include <libeblP.h>
 
+#include "../libelf/common.h"
+#include "../libelf/libelfP.h"
+#include "../libdw/libdwP.h"
+#include "../libdw/memory-access.h"
 
 void
 ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index 473a1f2f..c15379d6 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -31,11 +31,10 @@ 
 # include <config.h>
 #endif
 
-#include <system.h>
-
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
+
 #include <libeblP.h>
 
 
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index 02f80653..7dc760d8 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -31,15 +31,15 @@ 
 #endif
 
 #include <assert.h>
-#include <libelfP.h>
 #include <dwarf.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 
-#include <system.h>
 #include <libeblP.h>
 
+#include "../libelf/libelfP.h"
+
 Ebl *i386_init (Elf *, GElf_Half, Ebl *);
 Ebl *sh_init (Elf *, GElf_Half, Ebl *);
 Ebl *x86_64_init (Elf *, GElf_Half, Ebl *);
diff --git a/libebl/eblresolvesym.c b/libebl/eblresolvesym.c
index 470f6f06..b859bba3 100644
--- a/libebl/eblresolvesym.c
+++ b/libebl/eblresolvesym.c
@@ -30,9 +30,10 @@ 
 # include <config.h>
 #endif
 
-#include <libeblP.h>
 #include <assert.h>
 
+#include <libeblP.h>
+
 bool
 ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
 {
diff --git a/libebl/libeblP.h b/libebl/libeblP.h
index c408ed97..14cb70f3 100644
--- a/libebl/libeblP.h
+++ b/libebl/libeblP.h
@@ -30,9 +30,11 @@ 
 #define _LIBEBLP_H 1
 
 #include <gelf.h>
-#include <libasm.h>
 #include <libebl.h>
 
+#include <system.h>
+
+#include <../libasm/libasm.h>
 
 /* Backend handle.  */
 struct ebl