# HG changeset patch # User Michael Pavone # Date 1588314622 25200 # Node ID 42c12d141f6e82192ab80808400b0ab78233046b # Parent 8494fe8d6b659713fea3e443a06b445991ed05a2 Remove usage of GCC pointer arithmetic on void * extension diff -r 8494fe8d6b65 -r 42c12d141f6e Makefile --- a/Makefile Thu Apr 30 23:21:23 2020 -0700 +++ b/Makefile Thu Apr 30 23:30:22 2020 -0700 @@ -31,7 +31,7 @@ GLUDIR:=x64 endif GLEW32S_LIB:=$(GLEW_PREFIX)/lib/Release/$(GLUDIR)/glew32s.lib -CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration +CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wpointer-arith -Werror=pointer-arith LDFLAGS:=-lm -lmingw32 -lws2_32 -mwindows ifneq ($(MAKECMDGOALS),libblastem.dll) CFLAGS+= -I"$(SDL2_PREFIX)/include/SDL2" -I"$(GLEW_PREFIX)/include" -DGLEW_STATIC @@ -47,7 +47,7 @@ EXE:= HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi) -CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) -DHAVE_UNISTD_H +CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value -Wpointer-arith -Werror=pointer-arith $(HAS_PROC) -DHAVE_UNISTD_H ifeq ($(OS),Darwin) LIBS=sdl2 glew diff -r 8494fe8d6b65 -r 42c12d141f6e backend.c --- a/backend.c Thu Apr 30 23:21:23 2020 -0700 +++ b/backend.c Thu Apr 30 23:30:22 2020 -0700 @@ -83,7 +83,7 @@ : memmap[chunk].buffer; if (!base) { if (memmap[chunk].flags & MMAP_AUX_BUFF) { - return memmap[chunk].buffer + (address & memmap[chunk].aux_mask); + return ((uint8_t *)memmap[chunk].buffer) + (address & memmap[chunk].aux_mask); } return NULL; } @@ -108,7 +108,7 @@ : memmap[chunk].buffer; if (!base) { if (memmap[chunk].flags & MMAP_AUX_BUFF) { - return memmap[chunk].buffer + (address & memmap[chunk].aux_mask); + return ((uint8_t *)memmap[chunk].buffer) + (address & memmap[chunk].aux_mask); } return NULL; } diff -r 8494fe8d6b65 -r 42c12d141f6e blastem.c --- a/blastem.c Thu Apr 30 23:21:23 2020 -0700 +++ b/blastem.c Thu Apr 30 23:30:22 2020 -0700 @@ -158,8 +158,9 @@ for (offset = 0; offset + SMD_BLOCK_SIZE + SMD_HEADER_SIZE <= out_size; offset += SMD_BLOCK_SIZE) { uint8_t tmp[SMD_BLOCK_SIZE]; - memcpy(tmp, *dst + offset + SMD_HEADER_SIZE, SMD_BLOCK_SIZE); - process_smd_block(*dst + offset, tmp, SMD_BLOCK_SIZE); + uint8_t *u8dst = *dst; + memcpy(tmp, u8dst + offset + SMD_HEADER_SIZE, SMD_BLOCK_SIZE); + process_smd_block((void *)(u8dst + offset), tmp, SMD_BLOCK_SIZE); } out_size = offset; } diff -r 8494fe8d6b65 -r 42c12d141f6e render_sdl.c --- a/render_sdl.c Thu Apr 30 23:21:23 2020 -0700 +++ b/render_sdl.c Thu Apr 30 23:30:22 2020 -0700 @@ -1361,14 +1361,14 @@ warning("Request for invalid framebuffer number %d\n", which); return NULL; } - void *pixels; - if (SDL_LockTexture(sdl_textures[which], NULL, &pixels, pitch) < 0) { + uint8_t *pixels; + if (SDL_LockTexture(sdl_textures[which], NULL, (void **)&pixels, pitch) < 0) { warning("Failed to lock texture: %s\n", SDL_GetError()); return NULL; } static uint8_t last; if (which <= FRAMEBUFFER_EVEN) { - locked_pixels = pixels; + locked_pixels = (uint32_t *)pixels; if (which == FRAMEBUFFER_EVEN) { pixels += *pitch; } @@ -1378,7 +1378,7 @@ } last = which; } - return pixels; + return (uint32_t *)pixels; #ifndef DISABLE_OPENGL } #endif diff -r 8494fe8d6b65 -r 42c12d141f6e romdb.c --- a/romdb.c Thu Apr 30 23:21:23 2020 -0700 +++ b/romdb.c Thu Apr 30 23:30:22 2020 -0700 @@ -675,7 +675,9 @@ *map = lock_info.map[i]; if (map->start < 0x200000) { if (map->buffer) { - map->buffer += (0x200000 - map->start) & ((map->flags & MMAP_AUX_BUFF) ? map->aux_mask : map->mask); + uint8_t *buf = map->buffer; + buf += (0x200000 - map->start) & ((map->flags & MMAP_AUX_BUFF) ? map->aux_mask : map->mask); + map->buffer = buf; } map->start = 0x200000; }