IUCompilerCourse / Essentials-of-Compilation

A book about compiling Racket and Python to x86-64 assembly
1.28k stars 140 forks source link

Warning while compiling with GCC on linux #124

Open abhin4v opened 2 years ago

abhin4v commented 2 years ago

Compiling with GCC on linux with warnings on throws these warnings:

runtime.c: In function ‘print_heap’:
runtime.c:587:18: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘long int’ [-Wformat=]
  587 |       printf("%lld", (int64_t)*root_loc);
      |               ~~~^   ~~~~~~~~~~~~~~~~~~
      |                  |   |
      |                  |   long int
      |                  long long int
      |               %ld
runtime.c: In function ‘print_vector’:
runtime.c:601:14: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘long int’ [-Wformat=]
  601 |   printf("%lld=#(", (int64_t)vector_ptr);
      |           ~~~^      ~~~~~~~~~~~~~~~~~~~
      |              |      |
      |              |      long int
      |              long long int
      |           %ld
runtime.c:608:18: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘long int’ [-Wformat=]
  608 |       printf("%lld", (int64_t)*scan_ptr);
      |               ~~~^   ~~~~~~~~~~~~~~~~~~
      |                  |   |
      |                  |   long int
      |                  long long int
      |               %ld
runtime.c: In function ‘read_int’:
runtime.c:504:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  504 |   scanf("%" SCNd64, &i);
      |   ^~~~~~~~~~~~~~~~~~~~~