[libc-commits] [PATCH] D79469: [libc] Fix warnings on release build.
Paula Toth via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue May 5 22:37:50 PDT 2020
PaulkaToast created this revision.
PaulkaToast added reviewers: abrachet, sivachandra.
PaulkaToast added a project: libc-project.
Herald added subscribers: libc-commits, tschuett.
These warnings were present when building llvm-libc in release mode.
workspace/llvm-project/libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp:50:34: warning: 'None' is deprecated: Use Align() or Align(1) instead [-Wdeprecated-declarations]
Conf.AddressAlignment = Align::None();
workspace/llvm-project/libc/utils/testutils/FDReaderUnix.cpp:19:7: warning: unused variable 'err' [-Wunused-variable]
int err = ::pipe(pipefd);
For test-utils it seems in general we should use `report_fatal_error` instead of asserts as these are turned off when building in release mode.
https://llvm.org/docs/CodingStandards.html#assert-liberally
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79469
Files:
libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp
libc/utils/testutils/FDReaderUnix.cpp
Index: libc/utils/testutils/FDReaderUnix.cpp
===================================================================
--- libc/utils/testutils/FDReaderUnix.cpp
+++ libc/utils/testutils/FDReaderUnix.cpp
@@ -17,7 +17,8 @@
FDReader::FDReader() {
int err = ::pipe(pipefd);
- assert(!err && "pipe(2) failed");
+ if (err)
+ llvm::report_fatal_error("pipe(2) failed");
}
FDReader::~FDReader() {
Index: libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp
===================================================================
--- libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp
+++ libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp
@@ -47,7 +47,8 @@
TEST(OffsetDistribution, NoAlignment) {
StudyConfiguration Conf;
Conf.BufferSize = 8192;
- Conf.AddressAlignment = Align::None();
+ // Default constructor has no alignment.
+ Conf.AddressAlignment = Align();
Conf.Size.To = 1;
OffsetDistribution OD(Conf);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79469.262291.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200506/b634e9d3/attachment.bin>
More information about the libc-commits
mailing list