[libc-commits] [libc] 0ed4b17 - [libc] Quiet initializer warnings in getopt
Roland McGrath via libc-commits
libc-commits at lists.llvm.org
Mon Jul 31 16:50:58 PDT 2023
Author: Roland McGrath
Date: 2023-07-31T16:50:40-07:00
New Revision: 0ed4b17707aa71bf9323617b9daa724b111d921f
URL: https://github.com/llvm/llvm-project/commit/0ed4b17707aa71bf9323617b9daa724b111d921f
DIFF: https://github.com/llvm/llvm-project/commit/0ed4b17707aa71bf9323617b9daa724b111d921f.diff
LOG: [libc] Quiet initializer warnings in getopt
This prevents -Wmissing-braces warnings.
Reviewed By: michaelrj, Caslyn
Differential Revision: https://reviews.llvm.org/D156629
Added:
Modified:
libc/src/unistd/getopt.cpp
Removed:
################################################################################
diff --git a/libc/src/unistd/getopt.cpp b/libc/src/unistd/getopt.cpp
index 70ca454315d3ed..d063a43202136a 100644
--- a/libc/src/unistd/getopt.cpp
+++ b/libc/src/unistd/getopt.cpp
@@ -22,6 +22,9 @@
namespace __llvm_libc {
template <typename T> struct RefWrapper {
+ RefWrapper() = delete;
+ constexpr RefWrapper(T *p) : ptr{p} {}
+ constexpr RefWrapper(const RefWrapper &) = default;
RefWrapper &operator=(const RefWrapper &) = default;
operator T &() { return *ptr; }
T &get() { return *ptr; }
More information about the libc-commits
mailing list