sapling/eden/fs/fuse
Victor Zverovich f3feef687f Deprecate folly::format
Summary:
`folly::format` is a problematic API because it returns a `Formatter` object that may store references to arguments as its comment warns:

```
 * Formatter class.
 *
 * Note that this class is tricky, as it keeps *references* to its lvalue
 * arguments (while it takes ownership of the temporaries), and it doesn't
 * copy the passed-in format string. Thankfully, you can't use this
 * directly, you have to use format(...) below.
```

This has negative safety and performance (encourages reuse of the same formatter) implications because contrary to what the comment says you can use the object directly since it's returned from `folly::format`. For example
```
auto f = folly::format(std::string("{}"), 42);
f.str();
```
is a UB with no compile-time diagnostic (only caught by ASAN).

It's also unnecessary because the `Formatter` object is usually converted to string straight away via `str()` or written to an output stream. Reusing the formatter doesn't make much sense either because the expensive part is formatting, not capturing arguments.

This diff deprecates `folly::format` suggesting `fmt::format` as a potential replacement. `fmt::format` doesn't have the above problem because arguments are always in scope. It also has the following advantages:

* Better compile times.
* Compile-time format string checks.
* Compatibility with C++20 `std::format`.
* Better performance, particularly with format string compilation which eliminates format string processing overhead altogether.
* Smaller binary footprint.

Also remove `folly::writeTo` which is no longer used and the `format_nested_fbstrings` benchmark which is identical to `format_nested_strings` since there is no `fbstr()` any more.

Reviewed By: yfeldblum

Differential Revision: D26391489

fbshipit-source-id: f0309e78db0eb6d8c22b426d4cc333a17c53f73e
2021-02-27 07:02:55 -08:00
..
fuse_tester path: forbid building non-utf8 paths 2021-02-23 11:35:12 -08:00
privhelper privhelper: add an nfsUnmount command 2021-02-22 22:40:39 -08:00
test path: forbid building non-utf8 paths 2021-02-23 11:35:12 -08:00
CMakeLists.txt move strace logging into FuseChannel 2020-10-20 09:34:03 -07:00
DirList.cpp Apply clang-format update fixes 2021-01-10 10:06:29 -08:00
DirList.h Tidy up license headers 2019-10-11 05:28:23 -07:00
FuseChannel.cpp Deprecate folly::format 2021-02-27 07:02:55 -08:00
FuseChannel.h log returned inode numbers from lookup/create/mkdir 2021-02-23 12:27:10 -08:00
FuseDispatcher.cpp inodes: move dispatchers around 2021-02-10 11:52:06 -08:00
FuseDispatcher.h inodes: move dispatchers around 2021-02-10 11:52:06 -08:00
FuseRequestContext.cpp log returned inode numbers from lookup/create/mkdir 2021-02-23 12:27:10 -08:00
FuseRequestContext.h log returned inode numbers from lookup/create/mkdir 2021-02-23 12:27:10 -08:00
FuseTypes.h move third-party/ into eden/fs/ 2020-05-04 11:33:12 -07:00
Invalidation.h make unlink and rmdir explicit about kernel cache invalidation 2020-07-28 14:47:40 -07:00
PollHandle.cpp fs: ifdef linux/macos only files 2020-09-23 12:20:41 -07:00
PollHandle.h Tidy up license headers 2019-10-11 05:28:23 -07:00