Skip to content

Commit

Permalink
Removing API usage not applicable on iOS (stat and fstat) in libhermes
Browse files Browse the repository at this point in the history
Summary:
This diff just removes references to functions that use (either
directly or transitively) those functions, and relies on linker DCE
to clean up the rest. Trying to extricate all uses of these functions
would otherwise result in very significant changes.

This diff makes two changes:
1. In raw_fd_ostream, fall back to a default buffer size when building
for iOS.
2. Update a function in LLVM that was marked as "used" to suppress
warnings, to instead use the new `[[maybe_unused]]` attribute. This
allows the function, and the calls to stat it retains, to be stripped.

Reviewed By: tmikov, TheSavior

Differential Revision: D53133166

fbshipit-source-id: f425762bc6b7072cbd8235c65e9cf652cecb981c
  • Loading branch information
neildhar authored and cipolleschi committed Apr 26, 2024
1 parent 93ee9e2 commit 644c8be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion external/llvh/lib/Support/Signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static FormattedNumber format_ptr(void *PC) {
}

/// Helper that launches llvm-symbolizer and symbolizes a backtrace.
LLVM_ATTRIBUTE_USED
[[maybe_unused]]
static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace,
int Depth, llvh::raw_ostream &OS) {
if (DisableSymbolicationFlag)
Expand Down
2 changes: 1 addition & 1 deletion external/llvh/lib/Support/raw_ostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ size_t raw_fd_ostream::preferred_buffer_size() const {
if (IsWindowsConsole)
return 0;
return raw_ostream::preferred_buffer_size();
#elif !defined(__minix)
#elif !defined(__minix) && !(defined(__APPLE__) && defined(HERMES_IS_MOBILE_BUILD))
// Minix has no st_blksize.
assert(FD >= 0 && "File not yet open!");
struct stat statbuf;
Expand Down

0 comments on commit 644c8be

Please sign in to comment.