Browse Source

Fix build warning about discarding volatile qualifier in memory.c

The warning was:
```
[4339/5327] Building C object driver/others/CMakeFiles/driver_others.dir/memory.c.o
/home/rgommers/code/pixi-dev-scipystack/openblas/OpenBLAS/driver/others/memory.c: In function 'blas_shutdown':
/home/rgommers/code/pixi-dev-scipystack/openblas/OpenBLAS/driver/others/memory.c:3257:10: warning: passing argument 1 of 'free' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
 3257 |     free(newmemory);
      |          ^~~~~~~~~
In file included from /home/rgommers/code/pixi-dev-scipystack/openblas/OpenBLAS/common.h:83,
                 from /home/rgommers/code/pixi-dev-scipystack/openblas/OpenBLAS/driver/others/memory.c:74:
/home/rgommers/code/pixi-dev-scipystack/openblas/.pixi/envs/default/x86_64-conda-linux-gnu/sysroot/usr/include/stdlib.h:482:25: note: expected 'void *' but argument is of type 'volatile struct newmemstruct *'
  482 | extern void free (void *__ptr) __THROW;
      |                   ~~~~~~^~~~~
```

The use of `volatile` for `newmemstruct` seems on purpose, and there are
more such constructs in this file. The warning appeared after gh-4451
and is correct. The `free` prototype doesn't expect a volatile pointer,
hence this change adds a cast to silence the warning.
tags/v0.3.29
Ralf Gommers 9 months ago
parent
commit
48caf2303d
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      driver/others/memory.c

+ 1
- 1
driver/others/memory.c View File

@@ -3254,7 +3254,7 @@ void blas_shutdown(void){
#endif #endif
newmemory[pos].lock = 0; newmemory[pos].lock = 0;
} }
free(newmemory);
free((void*)newmemory);
newmemory = NULL; newmemory = NULL;
memory_overflowed = 0; memory_overflowed = 0;
} }


Loading…
Cancel
Save