Fix warnings

This change fixes Cosmopolitan so it has fewer opinions about compiler
warnings. The whole repository had to be cleaned up to be buildable in
-Werror -Wall mode. This lets us benefit from things like strict const
checking. Some actual bugs might have been caught too.
This commit is contained in:
Justine Tunney 2023-09-01 20:49:13 -07:00
parent e2b3c3618e
commit 0d748ad58e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
571 changed files with 1306 additions and 1888 deletions

View file

@ -49,6 +49,8 @@
// see tool/hello/hello-pe.c for an example program this can link
// make -j8 m=tiny o/tiny/tool/hello/hello-pe.com
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#define VERSION \
"elf2pe v0.1\n" \
"copyright 2023 justine tunney\n" \
@ -273,7 +275,6 @@ static void RelocateRela(struct Elf *elf, struct Segment *segment,
RelocateVaddrWithinSegment(elf, rela->r_offset, segment);
Elf64_Addr symbol_vaddr = elf->symtab[ELF64_R_SYM(rela->r_info)].st_value;
char *place_ptr = segment->ptr_new + (place_vaddr - segment->vaddr_new_min);
Elf64_Sxword addend = rela->r_addend;
switch (ELF64_R_TYPE(rela->r_info)) {
case R_X86_64_NONE: // do nothing
case R_X86_64_COPY: // do nothing
@ -1032,7 +1033,6 @@ static struct ImagePointer GeneratePe(struct Elf *elf, char *fp, int64_t vp) {
static void GetOpts(int argc, char *argv[]) {
int opt;
char *endptr;
while ((opt = getopt(argc, argv, "ho:D:")) != -1) {
switch (opt) {
case 'o':