riscv-fesvr
riscv-fesvr copied to clipboard
error: expected unqualified-id before '(' token
Any idea what this is about?
/home/lukas/libreelec/build.LibreELEC-HiFive.riscv64-9.0-devel/riscv-fesvr-f683e01/fesvr/encoding.h:178:29: error: expected unqualified-id before '(' token
#define write_csr(reg, val) ({ \
^
/home/lukas/libreelec/build.LibreELEC-HiFive.riscv64-9.0-devel/riscv-fesvr-f683e01/fesvr/dtm.cc:393:17: note: in expansion of macro 'write_csr'
uint64_t dtm_t::write_csr(unsigned which, uint64_t data)
^~~~~~~~~
build log http://sprunge.us/LTBO
./build.LibreELEC-HiFive.riscv64-9.0-devel/toolchain/bin/riscv64-libreelec-linux-gnu-g++ --version
riscv64-libreelec-linux-gnu-g++-7.2.0 (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Hello,
write_csr
is both used as macro (in encoding.h, line 198) and as function name (in dtm.cc, line 405), resulting in a compile error.
My solution (not a clever solution, though) is to comment the #include "encoding.h"
and add #define CSR_DSCRATCH 0x7b2
in dtm.cc. Since CSR_DSCRATCH is a constant needed in dtm.cc defined in encoding.h but including encoding.h will cause naming conflict.
i.e. in dtm.cc replace this
#include "dtm.h"
#include "debug_defines.h"
#include "encoding.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
with this
#include "dtm.h"
#include "debug_defines.h"
// #include "encoding.h"
#define CSR_DSCRATCH 0x7b2
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
Hope that there will be a bug fix soon!
Update 1: I put my compiling notes and a script to compile riscv-isa-sim in my repo. Hope it helps!