Skip to contentSkip to conversation

tests/tcg: Don't #include <inttypes.h> in aarch64/system/vtimer.c

PATCH Applied Ilya Leoshkevich 3 participants 4 messages Jan 8, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/tcg: Don't #include <inttypes.h> in aarch64/system/vtimer.c

make check-tcg fails on Fedora with:

vtimer.c:9:10: fatal error: inttypes.h: No such file or directory

Fedora has a minimal aarch64 cross-compiler, which satisfies the configure checks, so it's chosen instead of the dockerized one. There is no cross-version of inttypes.h, however.

Fix by using stdint.h instead. The test does not require anything from inttypes.h anyway.

---
 tests/tcg/aarch64/system/vtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/aarch64/system/vtimer.c +1 -1
index 42f2f7796c7..7d725eced34 100644
@@ -6,7 +6,7 @@
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
-#include <inttypes.h>
+#include <stdint.h>
 #include <minilib.h>
 
 /* grabbed from Linux */
Signature · 1 line
2.43.0
#1 lore raw

Hi Ilya,

Quoted 7 lines · Ilya Leoshkevich

make check-tcg fails on Fedora with:

vtimer.c:9:10: fatal error: inttypes.h: No such file or directory

Fedora has a minimal aarch64 cross-compiler, which satisfies the configure checks, so it's chosen instead of the dockerized one. There is no cross-version of inttypes.h, however.

Presumably this isn't specific to aarch64 target, so what about the other uses, shouldn't we clean all similar uses at once?

$ git grep inttypes.h tests/tcg | wc -l
      26
Quoted 21 lines

Fix by using stdint.h instead. The test does not require anything from inttypes.h anyway.

---
  tests/tcg/aarch64/system/vtimer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/aarch64/system/vtimer.c +1 -1
index 42f2f7796c7..7d725eced34 100644
@@ -6,7 +6,7 @@
   * SPDX-License-Identifier: GPL-2.0-or-later
   */
 
-#include <inttypes.h>
+#include <stdint.h>
  #include <minilib.h>
 
  /* grabbed from Linux */
#2 lore raw
Quoted 12 lines · Philippe Mathieu-Daudé

Hi Ilya,

Quoted 8 lines · Ilya Leoshkevich

make check-tcg fails on Fedora with:

     vtimer.c:9:10: fatal error: inttypes.h: No such file or directory

Fedora has a minimal aarch64 cross-compiler, which satisfies the configure checks, so it's chosen instead of the dockerized one. There is no cross-version of inttypes.h, however.

Quoted 5 lines

Presumably this isn't specific to aarch64 target, so what about the other uses, shouldn't we clean all similar uses at once?

$ git grep inttypes.h tests/tcg | wc -l
       26

As far as I can see, these 26 occurrences are for user tests.

These work fine; I assume this is because the user cross-compiler is chosen using a stricter configure check:

write_c_skeleton
case $1 in
*-softmmu)
if do_compiler "$target_cc" $target_cflags -o $TMPO -c $TMPC &&
do_compiler "$target_cc" $target_cflags -r -nostdlib -o
"${TMPDIR1}/${TMPB}2.o" "$TMPO" -lgcc; then

          got_cross_cc=yes
          break
        fi
        ;;
      *)
        if do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC -
static ; then
          build_static=y
          got_cross_cc=yes
          break
        fi
        if do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC ;
then
          build_static=
          got_cross_cc=yes
          break
        fi
        ;;
    esac

[...]