pret / agbcc

C compiler
111 stars 80 forks source link

Multiple declaration errors while compiling #72

Closed AxelElRojo closed 3 months ago

AxelElRojo commented 3 months ago

Hi, As the title states, I am getting multiple declaration errors while trying to compile:

rtl.c:121:13: error: ‘BITS_PER_UNIT’ undeclared here (not in a function)
  121 |   ((SIZE) * BITS_PER_UNIT >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (SIZE) * BITS_PER_UNIT) - 1,

machmode.h:35:32: error: ‘HOST_BITS_PER_INT’ undeclared here (not in a function); did you mean ‘HOST_BITS_PER_WIDE_INT’?
   35 | #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT

system.h:353:8: error: ‘FATAL_EXIT_CODE’ undeclared (first use in this function)
  353 |  exit (FATAL_EXIT_CODE))

These are just a few I'm getting, if I fix these (either by re declaring or including the files that contain the declarations) I get more of these, until eventually I get an undefined FIRST_PSEUDO_REGISTER error, while looking for its declaration, I see there are multiple:

$ git grep "#define FIRST_PSEUDO_REGISTER"
gcc/thumb.h:#define FIRST_PSEUDO_REGISTER 17
gcc_arm/config/arm/arm.h:#define FIRST_PSEUDO_REGISTER  27
gcc_arm/config/arm/arm_010110a.h:#define FIRST_PSEUDO_REGISTER  27
gcc_arm/config/arm/arm_020422.h:#define FIRST_PSEUDO_REGISTER  27
gcc_arm/config/arm/arm_020428.h:#define FIRST_PSEUDO_REGISTER  27
gcc_arm/config/arm/arm_990720.h:#define FIRST_PSEUDO_REGISTER  27
gcc_arm/config/arm/thumb.h:#define FIRST_PSEUDO_REGISTER 17
gcc_arm/config/arm/thumb.h.orig:#define FIRST_PSEUDO_REGISTER 17
gcc_arm/config/arm/thumb_000513.h:#define FIRST_PSEUDO_REGISTER 17
gcc_arm/config/arm/thumb_020422.h:#define FIRST_PSEUDO_REGISTER 17
gcc_arm/config/arm/thumb_020428.h:#define FIRST_PSEUDO_REGISTER 17

This leads me to believe that this is not the proper approach to fix these issues. Do you know if I'm doing something wrong or missing something? I already applied the patch provided in #68, which solved the function pointer issues.

My system is running Arch Linux and has the following package versions:

AxelElRojo commented 3 months ago

Fixed by including the patch provided by danieltanfh95 in #69