[libcxx-commits] [PATCH] D158282: [libc++] Stop using strict availability markup on Apple

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 18 07:48:35 PDT 2023


ldionne created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

We've been increasingly running into issues with availability markup
in the library lately. In particular, the fact that `strict` availability
markup causes functions to act as-if they were deleted breaks the library
in various ways, making it impossible AFAICT to enable availability markup
for PMR. It also causes a lot of spurious diagnostics in e.g. <format>,
as can be seen by the multiple TODO comments removed in this patch.

This patch uses non-strict availability markup instead, which is used
much more widely on Apple platforms. The difference is that using an
unavailable API will trigger a warning instead of an error, and that
using an unavailable API will cause a weak-definition to be emitted
(so it is possible to check at runtime whether the API is available).

This should resolve several difficulties we've been having with availability
markup, which I believe to have tracked down to fundamental implementation
constraints with the `strict` version of availability. In other words,
`strict` has some properties which are fundamentally undesirable for us,
and it was always possible to work around them but it isn't anymore.

This will also make it possible for users to branch on whether an API
is available at runtime, which has been requested by users.

As a follow-up to this patch, I should be able to clean up even more
availability workarounds in the library.

rdar://100138498


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158282

Files:
  libcxx/include/__availability
  libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp
  libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.verify.cpp
  libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp
  libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp
  libcxx/test/libcxx/thread/atomic.availability.verify.cpp
  libcxx/test/libcxx/thread/barrier.availability.verify.cpp
  libcxx/test/libcxx/thread/latch.availability.verify.cpp
  libcxx/test/libcxx/thread/semaphore.availability.verify.cpp
  libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.format.pass.cpp
  libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.vformat.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/print.file.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/print.sh.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/println.file.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/println.sh.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/vprint_nonunicode.file.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/vprint_nonunicode.sh.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.file.pass.cpp
  libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp
  libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.format.pass.cpp
  libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.vformat.pass.cpp
  libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp
  libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp
  libcxx/test/std/time/time.syn/formatter.day.pass.cpp
  libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
  libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp
  libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp
  libcxx/test/std/time/time.syn/formatter.month.pass.cpp
  libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp
  libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp
  libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp
  libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
  libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp
  libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp
  libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp
  libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp
  libcxx/test/std/utilities/format/format.functions/P2418.pass.cpp
  libcxx/test/std/utilities/format/format.functions/ascii.pass.cpp
  libcxx/test/std/utilities/format/format.functions/escaped_output.ascii.pass.cpp
  libcxx/test/std/utilities/format/format.functions/escaped_output.unicode.pass.cpp
  libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp
  libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp
  libcxx/test/std/utilities/format/format.functions/format.verify.cpp
  libcxx/test/std/utilities/format/format.functions/format_to.locale.verify.cpp
  libcxx/test/std/utilities/format/format.functions/format_to.verify.cpp
  libcxx/test/std/utilities/format/format.functions/format_to_n.locale.verify.cpp
  libcxx/test/std/utilities/format/format.functions/format_to_n.verify.cpp
  libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp
  libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp
  libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp
  libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp
  libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.verify.cpp
  libcxx/test/std/utilities/format/format.tuple/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.tuple/format.functions.format.verify.cpp
  libcxx/test/std/utilities/format/format.tuple/format.functions.vformat.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158282.551510.patch
Type: text/x-patch
Size: 67184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230818/4de43f25/attachment-0001.bin>


More information about the libcxx-commits mailing list