Bug 1950946 - Remove #define realloc for graphite2. r=gfx-reviewers,aosmond

Replacing realloc via define breaks libc++19.1.7:
```
In file included from Unified_cpp_gfx_graphite2_src0.cpp:29:
In file included from /build/firefox-135.0.1/gfx/graphite2/src/Collider.cpp:31:
In file included from /build/firefox-135.0.1/objdir/dist/stl_wrappers/functional:62:
In file included from /build/firefox-135.0.1/objdir/dist/system_wrappers/functional:3:
In file included from /nix/store/j34khyjjc2i4sxyxfk86bwcxlrz36z6g-libcxx-aarch64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/functional:552:
In file included from /nix/store/j34khyjjc2i4sxyxfk86bwcxlrz36z6g-libcxx-aarch64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/__functional/boyer_moore_searcher.h:27:
In file included from /build/firefox-135.0.1/objdir/dist/stl_wrappers/vector:62:
In file included from /build/firefox-135.0.1/objdir/dist/system_wrappers/vector:3:
In file included from /nix/store/j34khyjjc2i4sxyxfk86bwcxlrz36z6g-libcxx-aarch64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/vector:3023:
In file included from /build/firefox-135.0.1/objdir/dist/system_wrappers/locale:3:
/nix/store/j34khyjjc2i4sxyxfk86bwcxlrz36z6g-libcxx-aarch64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/locale:2458:26: error: no member named 'moz_xrealloc' in namespace 'std'
 2458 |   _Tp* __t       = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
      |                          ^~~~~
/build/firefox-135.0.1/objdir/dist/include/mozilla/mozalloc.h:82:16: note: 'moz_xrealloc' declared here
   82 | MFBT_API void* moz_xrealloc(void* ptr, size_t size) MOZ_INFALLIBLE_ALLOCATOR;
```

We no longer support GCC 5.4, so we shouldn't need this.

Differential Revision: https://phabricator.services.mozilla.com/D239955
This commit is contained in:
Kelsey Gilbert
2025-02-28 21:14:52 +00:00
parent c2b28c1f4b
commit 277c4c6dfb

View File

@@ -12,17 +12,8 @@
#include "mozilla/mozalloc.h" #include "mozilla/mozalloc.h"
#if defined(XP_LINUX) && !defined(ANDROID)
#define malloc moz_xmalloc
#define calloc moz_xcalloc
#define realloc moz_xrealloc
#else
// extern "C" is needed for the Solaris build, while the inline // extern "C" is needed for the Solaris build, while the inline
// functions are needed for the MinGW build. They break gcc 5.4.0 // functions are needed for the MinGW build.
// on Linux however, so keep the old #define's above for Linux
extern "C" inline void* malloc(size_t size) extern "C" inline void* malloc(size_t size)
{ {
@@ -39,6 +30,4 @@ extern "C" inline void* realloc(void *ptr, size_t size)
return moz_xrealloc(ptr, size); return moz_xrealloc(ptr, size);
} }
#endif // defined(XP_LINUX)
#endif // MOZ_GR_MALLOC_H #endif // MOZ_GR_MALLOC_H