Skip to content
  • Jens Petersen's avatar
    f983a00f
    hp2ps/Utilities.c: add extern parameter types for malloc and realloc for C23 · f983a00f
    Jens Petersen authored and Marge Bot's avatar Marge Bot committed
    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();
       |                  ^
    ```
    f983a00f
    hp2ps/Utilities.c: add extern parameter types for malloc and realloc for C23
    Jens Petersen authored and Marge Bot's avatar Marge Bot committed
    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();
       |                  ^
    ```
Loading