Fix z80 assembler build with newer compilers
Adds missing 'const' to a pointer in z80 assembler to fix build errors with modern GCC.
This commit resolves a build error in the z80 assembler (tc-z80.c) that occurs with newer versions of GCC and glibc. The issue stems from bsearch() and other functions propagating const-correctness, which conflicted with a non-const pointer used in the assembler’s internal tables. Adding the const qualifier to the pointer fixes the build without affecting functionality, as the pointer is never written to.
In Details
The tc-z80.c file uses bsearch() to look up register entries. Recent GCC versions (e.g., 16.2.1) and glibc (e.g., 2.43) have improved const propagation. The struct reg_entry *cc_p was declared without const, but bsearch()'s return value (from a const array) was being assigned to it, causing a build failure. Adding const to cc_p resolves this type mismatch.
- const
- A qualifier in C and C++ that indicates a variable or pointer cannot be modified after initialization. Compilers use it to perform optimizations and detect errors.
- bsearch
- A standard C library function that performs a binary search on a sorted array. It's commonly used for efficient lookups in tables.