[libcxx-commits] [PATCH] D93061: [libc++] ADL-proof by adding _VSTD:: qualifications to memmove etc. NFCI

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 10 12:53:01 PST 2020


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

Generally these calls aren't vulnerable to ADL because they involve only
primitive types. The ones in <list> and <vector> drag in namespace std
but that's OK; the ones in <fstream> and <strstream> are vulnerable
iff `CharT` is an enum type, which seems far-fetched.
But absolutely zero of them *need* ADL to happen; so in my opinion
they should all be consistently qualified, just like calls to any
other (non-user-customizable) functions in namespace std.

      

Also: Include <cstring> and <cwchar> in <__string>.
We seemed to be getting lucky that <memory> included <iterator>
included <iosfwd> included <wchar.h>. That gave us the
global-namespace `wmemmove`, but not `_VSTD::wmemmove`.
This is now fixed.

      

I didn't touch these headers:

  <ext/__hash> uses strlen, safely
  <support/ibm/locale_mgmt_aix.h> uses memcpy, safely
  <string.h> uses memchr and strchr, safely
  <wchar.h> uses wcschr, safely
  <__bsd_locale_fallbacks.h> uses wcsnrtombs, safely

There's a bit of overlap here with D92875 <https://reviews.llvm.org/D92875>; I'd plan to land that one before this one.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93061

Files:
  libcxx/include/__hash_table
  libcxx/include/__locale
  libcxx/include/__string
  libcxx/include/atomic
  libcxx/include/charconv
  libcxx/include/fstream
  libcxx/include/list
  libcxx/include/locale
  libcxx/include/string
  libcxx/include/strstream
  libcxx/include/vector

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93061.310986.patch
Type: text/x-patch
Size: 19246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201210/3f81fdb2/attachment-0001.bin>


More information about the libcxx-commits mailing list