lib/tests: Take RISC-V into account in size conditionals.

* lib/tests/scaffold/76-pointer-arithmetic.c (main): Use the right sizes
in the test for RISC-V architectures.
* lib/tests/scaffold/7k-for-each-elem.c (main): Same.
* lib/tests/scaffold/85-sizeof.c: Same.
This commit is contained in:
W. J. van der Laan 2021-04-04 18:06:36 +00:00 committed by Janneke Nieuwenhuizen
parent 04e6fdad13
commit 9d7360cca6
3 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -56,10 +57,10 @@ main ()
oputs (itoa (foo_size)); oputs (itoa (foo_size));
oputs ("\n"); oputs ("\n");
// FIXME: add *14, *18 // FIXME: add *14, *18
#if __i386__ || __arm__ #if __i386__ || __arm__ || __riscv_xlen == 32
int foo_size_14 = 224; int foo_size_14 = 224;
int foo_size_18 = 288; int foo_size_18 = 288;
#elif __x86_64__ #elif __x86_64__ || __riscv_xlen == 64
int foo_size_14 = 336; int foo_size_14 = 336;
int foo_size_18 = 432; int foo_size_18 = 432;
#endif #endif

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -47,11 +48,11 @@ struct section section;
int int
main () main ()
{ {
#if __i386__ || __arm__ #if __i386__ || __arm__ || __riscv_xlen == 32
int sym_size = 8; int sym_size = 8;
#elif __GNUC__ && __x86_64__ #elif __GNUC__ && (__x86_64__ || __riscv_xlen == 64)
int sym_size = 16; int sym_size = 16;
#elif __MESC__ && __x86_64__ #elif __MESC__ && (__x86_64__ || __riscv_xlen == 64)
int sym_size = 12; int sym_size = 12;
#endif #endif

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -34,11 +35,11 @@ struct bar
}; };
}; };
#if __i386__ || __arm__ #if __i386__ || __arm__ || __riscv_xlen == 32
#define ptr_size 4 #define ptr_size 4
#define foo_size 20 #define foo_size 20
#define bar_size 12 #define bar_size 12
#elif __x86_64__ #elif __x86_64__ || __riscv_xlen == 64
#define ptr_size 8 #define ptr_size 8
#define foo_size 24 #define foo_size 24
#define bar_size 12 #define bar_size 12