NJU-ProjectN / nemu

NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching
Other
858 stars 184 forks source link

fix: compile error on ./nemu/tools/gen-expr/gen-expr.c #64

Closed junyu33 closed 1 year ago

junyu33 commented 1 year ago

I use Ubuntu 22.04.2 LTS the default gcc version is 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

~/Desktop/github/ics2022/nemu/tools/gen-expr pa1 !1
> make
+ CC gen-expr.c
gen-expr.c: In function ‘main’:
gen-expr.c:63:5: error: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   63 |     fscanf(fp, "%d", &result);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [/home/junyu33/Desktop/github/ics2022/nemu/scripts/build.mk:34: /home/junyu33/Desktop/github/ics2022/nemu/tools/gen-expr/build/obj-gen-expr/gen-expr.o] Error 1

btw, the course is wonderful and I've learnt a lot which is practical for me.

sashimi-yzh commented 1 year ago

Thank you very much!