diff mbox series

tsystem.h: Declare calloc/realloc #ifdef inhibit_libc

Message ID 4acc4d97-bc80-4d2b-b00e-4eaa872d5f53@codesourcery.com
State New
Headers show
Series tsystem.h: Declare calloc/realloc #ifdef inhibit_libc | expand

Commit Message

Tobias Burnus Dec. 5, 2023, 5:29 p.m. UTC
Crossref, there is are -Wbuiltin-declaration-mismatch warnings in libgcc/emutls.c,
cf. https://gcc.gnu.org/PR109289

I decided to leave this to Thomas and Florian and just fix the build issue with
the attached patch. That build issue was also mentioned in PR libgcc/109289.

An alternative would be __builtin, but as the other #define were pre-existing,
I went for the tsystem.h version.

OK for mainline?

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

Comments

Jakub Jelinek Dec. 5, 2023, 5:33 p.m. UTC | #1
On Tue, Dec 05, 2023 at 06:29:10PM +0100, Tobias Burnus wrote:
> Crossref, there is are -Wbuiltin-declaration-mismatch warnings in libgcc/emutls.c,
> cf. https://gcc.gnu.org/PR109289
> 
> I decided to leave this to Thomas and Florian and just fix the build issue with
> the attached patch. That build issue was also mentioned in PR libgcc/109289.
> 
> An alternative would be __builtin, but as the other #define were pre-existing,
> I went for the tsystem.h version.
> 
> OK for mainline?
> 
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

> tsystem.h: Declare calloc/realloc #ifdef inhibit_libc
> 
> Declare calloc and realloc #ifndef and inhibit_libc is
> defined.  Those are used by libgcc/emutls.c.
> 
> gcc/ChangeLog:
> 
> 	* tsystem.h (calloc, realloc): Declare when inhibit_libc.

Ok, thanks.

	Jakub
diff mbox series

Patch

tsystem.h: Declare calloc/realloc #ifdef inhibit_libc

Declare calloc and realloc #ifndef and inhibit_libc is
defined.  Those are used by libgcc/emutls.c.

gcc/ChangeLog:

	* tsystem.h (calloc, realloc): Declare when inhibit_libc.

diff --git a/gcc/tsystem.h b/gcc/tsystem.h
index 081c73345cd..c49ff578cb7 100644
--- a/gcc/tsystem.h
+++ b/gcc/tsystem.h
@@ -47,12 +47,20 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifdef inhibit_libc
 
 #ifndef malloc
 extern void *malloc (size_t);
 #endif
 
+#ifndef calloc
+extern void *calloc(size_t, size_t);
+#endif
+
+#ifndef realloc
+extern void *realloc(void *, size_t);
+#endif
+
 #ifndef free
 extern void free (void *);
 #endif
 
 #ifndef atexit
 extern int atexit (void (*)(void));