[Semihosting Tests PATCH 2/3] update includes for bare metal compiling

Alex Bennée posted 3 patches 6 months, 2 weeks ago
There is a newer version of this series
[Semihosting Tests PATCH 2/3] update includes for bare metal compiling
Posted by Alex Bennée 6 months, 2 weeks ago
We shouldn't use <string.h> for our own implementation. Also the base
types we need live in <stdint.h> as <inttypes.h> doesn't exist for the
bare metal compilers.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 semihosting.c | 4 ++--
 semihosting.h | 2 +-
 string.c      | 2 +-
 usertest.c    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/semihosting.c b/semihosting.c
index 7a0ee0c..27dafbe 100644
--- a/semihosting.c
+++ b/semihosting.c
@@ -16,8 +16,8 @@
  *    from this software without specific prior written permission.
  */
 
-#include <inttypes.h>
-#include <string.h>
+#include <stdint.h>
+#include "string.h"
 #include "semihosting.h"
 
 int semi_open(char const *filename, int mode)
diff --git a/semihosting.h b/semihosting.h
index 06cda8d..68344fb 100644
--- a/semihosting.h
+++ b/semihosting.h
@@ -19,7 +19,7 @@
 #ifndef SEMIHOSTING_H
 #define SEMIHOSTING_H
 
-#include <inttypes.h>
+#include <stdint.h>
 
 #define SYS_OPEN	1
 #define OPEN_RDONLY	1
diff --git a/string.c b/string.c
index 045d71b..c289aa1 100644
--- a/string.c
+++ b/string.c
@@ -16,7 +16,7 @@
  *    from this software without specific prior written permission.
  */
 
-#include <string.h>
+#include "string.h"
 
 static void *__memmove_down(void *__dest, __const void *__src, size_t __n)
 {
diff --git a/usertest.c b/usertest.c
index ce0f61d..5df95f3 100644
--- a/usertest.c
+++ b/usertest.c
@@ -20,7 +20,7 @@
  *    from this software without specific prior written permission.
  */
 
-#include <stdio.h>
+#include "string.h"
 #include "semihosting.h"
 #include "printf/printf.h"
 
-- 
2.39.2


Re: [Semihosting Tests PATCH 2/3] update includes for bare metal compiling
Posted by Peter Maydell 6 months, 1 week ago
On Mon, 13 May 2024 at 12:35, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> We shouldn't use <string.h> for our own implementation. Also the base
> types we need live in <stdint.h> as <inttypes.h> doesn't exist for the
> bare metal compilers.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM