[Git][ghc/ghc][master] hp2ps/Utilities.c: add extern parameter types for malloc and realloc for C23
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Jan 21 21:11:42 UTC 2025
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f983a00f by Jens Petersen at 2025-01-21T16:11:12-05:00
hp2ps/Utilities.c: add extern parameter types for malloc and realloc for C23
Fix build with gcc-15 which defaults to C23 standard (-std=gnu23)
Fixes #25662
```
utils/hp2ps/Utilities.c:6:14: error:
warning: conflicting types for built-in function ‘malloc’; expected ‘void *(long unsigned int)’ [-Wbuiltin-declaration-mismatch]
6 | extern void* malloc();
| ^~~~~~
|
6 | extern void* malloc();
| ^
utils/hp2ps/Utilities.c:5:1: error:
note: ‘malloc’ is declared in header ‘<stdlib.h>’
4 | #include "Error.h"
+++ |+#include <stdlib.h>
5 |
|
5 |
| ^
utils/hp2ps/Utilities.c: In function ‘xmalloc’:
utils/hp2ps/Utilities.c:80:17: error:
error: too many arguments to function ‘malloc’; expected 0, have 1
80 | r = (void*) malloc(n);
| ^~~~~~ ~
|
80 | r = (void*) malloc(n);
| ^
utils/hp2ps/Utilities.c:6:14: error:
note: declared here
6 | extern void* malloc();
| ^~~~~~
|
6 | extern void* malloc();
| ^
utils/hp2ps/Utilities.c: In function ‘xrealloc’:
utils/hp2ps/Utilities.c:92:18: error:
warning: conflicting types for built-in function ‘realloc’; expected ‘void *(void *, long unsigned int)’ [-Wbuiltin-declaration-mismatch]
92 | extern void *realloc();
| ^~~~~~~
|
92 | extern void *realloc();
| ^
utils/hp2ps/Utilities.c:92:18: error:
note: ‘realloc’ is declared in header ‘<stdlib.h>’
|
92 | extern void *realloc();
| ^
utils/hp2ps/Utilities.c:94:9: error:
error: too many arguments to function ‘realloc’; expected 0, have 2
94 | r = realloc(p, n);
| ^~~~~~~ ~
|
94 | r = realloc(p, n);
| ^
utils/hp2ps/Utilities.c:92:18: error:
note: declared here
92 | extern void *realloc();
| ^~~~~~~
|
92 | extern void *realloc();
| ^
```
- - - - -
1 changed file:
- utils/hp2ps/Utilities.c
Changes:
=====================================
utils/hp2ps/Utilities.c
=====================================
@@ -3,7 +3,7 @@
#include <string.h>
#include "Error.h"
-extern void* malloc();
+extern void* malloc(long unsigned int);
char*
Basename(char *name)
@@ -89,7 +89,7 @@ void *
xrealloc(void *p, size_t n)
{
void *r;
- extern void *realloc();
+ extern void *realloc(void *, long unsigned int);
r = realloc(p, n);
if (!r) {
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f983a00ffc97b779eb52b10e69e254ec107f8311
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f983a00ffc97b779eb52b10e69e254ec107f8311
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250121/d4abd1ba/attachment-0001.html>
More information about the ghc-commits
mailing list