This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix 'ptsname_r' is only available on macOS 10.13.4 or newer
ClosedPublic

Authored by JDevlieghere on May 19 2022, 11:26 AM.

Details

Summary

A deployment target that's less than 10.13.4 causes an error saying that 'ptsname_r' is only available on macOS 10.13.4 or newer. The current logic only checks if the symbol is available and doesn't account for the deployment target. This patch fixes that.

Diff Detail

Event Timeline

JDevlieghere created this revision.May 19 2022, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 11:26 AM
JDevlieghere requested review of this revision.May 19 2022, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 11:26 AM
mib accepted this revision.May 19 2022, 11:42 AM

LGTM

This revision is now accepted and ready to land.May 19 2022, 11:42 AM
qram9 added a subscriber: qram9.May 25 2022, 9:52 AM

Hi there,

This change has caused the following warning:

llvm-project/lldb/source/Host/common/PseudoTerminal.cpp:106:20: error: unused function 'use_ptsname' [-Werror,-Wunused-function] static std::string use_ptsname(int fd) { ^

1 error generated.

The build compiler is clang++-12 on Ubuntu- 12.10.

Would you kindly look this over to add a fix?

Best,
Ram

PS:
Exact Build command:
/usr/bin/clang++ -DHAVE_ROUND -DLLDB_CONFIGURATION_DEBUG -D_DEBUG -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/vss/_work/1/b/llvm/Debug/tools/lldb/source/Host -I/mnt/vss/_work/1/llvm-project/lldb/source/Host -I/mnt/vss/_work/1/llvm-project/lldb/include -I/mnt/vss/_work/1/b/llvm/Debug/tools/lldb/include -I/mnt/vss/_work/1/b/llvm/Debug/include -I/mnt/vss/_work/1/llvm-project/llvm/include -I/mnt/vss/_work/1/llvm-project/llvm/../clang/include -I/mnt/vss/_work/1/b/llvm/Debug/tools/lldb/../clang/include -I/mnt/vss/_work/1/llvm-project/lldb/source -I/mnt/vss/_work/1/b/llvm/Debug/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g -fno-exceptions -gsplit-dwarf -std=c++14 -MD -MT tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/PseudoTerminal.cpp.o -MF tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/PseudoTerminal.cpp.o.d -o tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/PseudoTerminal.cpp.o -c /mnt/vss/_work/1/llvm-project/lldb/source/Host/common/PseudoTerminal.cpp

I was about to push a fix but it seems like it was already fixed by:

commit 4391625255c62074037d95a55232a87eae70c60b
Author: Kazu Hirata <kazu@google.com>
Date:   Wed May 25 09:49:05 2022 -0700

    [lldb] Fix an unused function warning

    This patch fixes:

      .../llvm-project/lldb/source/Host/common/PseudoTerminal.cpp:106:20:
      error: unused function 'use_ptsname' [-Werror,-Wunused-function]