From 7b0ae083b7ec7afe8c273195c12d075a3c16d13f Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 27 Jan 2015 10:44:40 -0500 Subject: Fix clang's only warning in non-test code, about a cast in the shmexport code. All regression tests pass with both gcc- and clang-built binaries. One clang warning remains in the JSON test code. --- gpsd.h-tail | 2 +- shmexport.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gpsd.h-tail b/gpsd.h-tail index 5a78876a..e7812262 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -278,7 +278,7 @@ struct gps_context_t { #ifdef SHM_EXPORT_ENABLE /* we don't want the compiler to treat writes to shmexport as dead code, * and we don't want them reordered either */ - /*@reldef@*/volatile char *shmexport; + /*@reldef@*/volatile void *shmexport; #endif ssize_t (*serial_write)(struct gps_device_t *, const char *buf, const size_t len); diff --git a/shmexport.c b/shmexport.c index 981a6ec2..1d9549d9 100644 --- a/shmexport.c +++ b/shmexport.c @@ -44,7 +44,7 @@ bool shm_acquire(struct gps_context_t *context) strerror(errno)); return false; } - context->shmexport = (char *)shmat(shmid, 0, 0); + context->shmexport = (void *)shmat(shmid, 0, 0); if ((int)(long)context->shmexport == -1) { gpsd_report(&context->errout, LOG_ERROR, "shmat failed: %s\n", strerror(errno)); context->shmexport = NULL; @@ -83,7 +83,7 @@ void shm_update(struct gps_context_t *context, struct gps_data_t *gpsdata) */ shared->bookend2 = tick; memory_barrier(); - memcpy((void *)(context->shmexport + offsetof(struct shmexport_t, gpsdata)), + memcpy((void *)((char *)context->shmexport + offsetof(struct shmexport_t, gpsdata)), (void *)gpsdata, sizeof(struct gps_data_t)); memory_barrier(); -- cgit v1.2.1