Commit cde2e241 by Abseil Team Committed by Derek Mauro

Export of internal Abseil changes

--
2aa4544070113a4943f93464df74759f043bab92 by CJ Johnson <johnsoncj@google.com>:

Spelling fix in InlinedVector

PiperOrigin-RevId: 308241764

--
0d8a8ff71023df845c490c73811da598a42f12d9 by Todd Jackson <tjackson@google.com>:

Fix CMake warnings on absl/types/CMakeLists.txt.

PiperOrigin-RevId: 308123331

--
f35fbd79437ba999097b1499770103b7865078e5 by Samuel Benzaquen <sbenza@google.com>:

Speed up the integral printer.

PiperOrigin-RevId: 308081531

--
b1676b869ed0547e1cca23c83bb370f459bdf2cb by Samuel Benzaquen <sbenza@google.com>:

Collapse the template arguments to enums earlier to reduce the number of
instantiations of FormatSpecTemplate.
This doesn't affect opt builds much, but reduces the bloat in non-opt builds.

PiperOrigin-RevId: 308066155

--
edda0c227adad392cfff2af6ed532822c481f013 by Abseil Team <absl-team@google.com>:

Minor documentation fix for `absl::Status` CTOR.

PiperOrigin-RevId: 308037725

--
8326b85569f0fdb15632b0076e38baba4c69794b by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 307914168
GitOrigin-RevId: 2aa4544070113a4943f93464df74759f043bab92
Change-Id: I553ce3838c5e35d04954f560dc75ec24033919af
parent 68494aae
...@@ -535,7 +535,7 @@ class InlinedVector { ...@@ -535,7 +535,7 @@ class InlinedVector {
// //
// Resizes the inlined vector to contain `n` elements. // Resizes the inlined vector to contain `n` elements.
// //
// NOTE: if `n` is smaller than `size()`, extra elements are destroyed. If `n` // NOTE: If `n` is smaller than `size()`, extra elements are destroyed. If `n`
// is larger than `size()`, new elements are value-initialized. // is larger than `size()`, new elements are value-initialized.
void resize(size_type n) { void resize(size_type n) {
ABSL_HARDENING_ASSERT(n <= max_size()); ABSL_HARDENING_ASSERT(n <= max_size());
......
...@@ -78,7 +78,7 @@ class ABSL_MUST_USE_RESULT Status final { ...@@ -78,7 +78,7 @@ class ABSL_MUST_USE_RESULT Status final {
Status(); Status();
// Create a status in the canonical error space with the specified code and // Create a status in the canonical error space with the specified code and
// error message. If `code == util::error::OK`, `msg` is ignored and an // error message. If `code == absl::StatusCode::kOk`, `msg` is ignored and an
// object identical to an OK status is constructed. // object identical to an OK status is constructed.
// //
// `msg` must be in UTF-8. The implementation may complain (e.g., // `msg` must be in UTF-8. The implementation may complain (e.g.,
......
...@@ -60,7 +60,7 @@ class UntypedFormatSpecImpl { ...@@ -60,7 +60,7 @@ class UntypedFormatSpecImpl {
size_t size_; size_t size_;
}; };
template <typename T, typename...> template <typename T, FormatConversionCharSet...>
struct MakeDependent { struct MakeDependent {
using type = T; using type = T;
}; };
...@@ -68,7 +68,7 @@ struct MakeDependent { ...@@ -68,7 +68,7 @@ struct MakeDependent {
// Implicitly convertible from `const char*`, `string_view`, and the // Implicitly convertible from `const char*`, `string_view`, and the
// `ExtendedParsedFormat` type. This abstraction allows all format functions to // `ExtendedParsedFormat` type. This abstraction allows all format functions to
// operate on any without providing too many overloads. // operate on any without providing too many overloads.
template <typename... Args> template <FormatConversionCharSet... Args>
class FormatSpecTemplate class FormatSpecTemplate
: public MakeDependent<UntypedFormatSpec, Args...>::type { : public MakeDependent<UntypedFormatSpec, Args...>::type {
using Base = typename MakeDependent<UntypedFormatSpec, Args...>::type; using Base = typename MakeDependent<UntypedFormatSpec, Args...>::type;
...@@ -105,13 +105,11 @@ class FormatSpecTemplate ...@@ -105,13 +105,11 @@ class FormatSpecTemplate
// Good format overload. // Good format overload.
FormatSpecTemplate(const char* s) // NOLINT FormatSpecTemplate(const char* s) // NOLINT
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s), __attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
"bad format trap")))
: Base(s) {} : Base(s) {}
FormatSpecTemplate(string_view s) // NOLINT FormatSpecTemplate(string_view s) // NOLINT
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s), __attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
"bad format trap")))
: Base(s) {} : Base(s) {}
#else // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER #else // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
...@@ -121,19 +119,14 @@ class FormatSpecTemplate ...@@ -121,19 +119,14 @@ class FormatSpecTemplate
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER #endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
template <Conv... C, typename = typename std::enable_if< template <Conv... C,
AllOf(sizeof...(C) == sizeof...(Args), typename = typename std::enable_if<
Contains(ArgumentToConv<Args>(), AllOf(sizeof...(C) == sizeof...(Args), Contains(Args,
C)...)>::type> C)...)>::type>
FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc) // NOLINT FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc) // NOLINT
: Base(&pc) {} : Base(&pc) {}
}; };
template <typename... Args>
struct FormatSpecDeductionBarrier {
using type = FormatSpecTemplate<Args...>;
};
class Streamable { class Streamable {
public: public:
Streamable(const UntypedFormatSpecImpl& format, Streamable(const UntypedFormatSpecImpl& format,
......
...@@ -170,21 +170,6 @@ inline FormatConversionChar FormatConversionCharFromChar(char c) { ...@@ -170,21 +170,6 @@ inline FormatConversionChar FormatConversionCharFromChar(char c) {
return FormatConversionChar::kNone; return FormatConversionChar::kNone;
} }
inline int FormatConversionCharRadix(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::x:
case FormatConversionChar::X:
case FormatConversionChar::a:
case FormatConversionChar::A:
case FormatConversionChar::p:
return 16;
case FormatConversionChar::o:
return 8;
default:
return 10;
}
}
inline bool FormatConversionCharIsUpper(FormatConversionChar c) { inline bool FormatConversionCharIsUpper(FormatConversionChar c) {
switch (c) { switch (c) {
case FormatConversionChar::X: case FormatConversionChar::X:
...@@ -198,30 +183,6 @@ inline bool FormatConversionCharIsUpper(FormatConversionChar c) { ...@@ -198,30 +183,6 @@ inline bool FormatConversionCharIsUpper(FormatConversionChar c) {
} }
} }
inline bool FormatConversionCharIsSigned(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::d:
case FormatConversionChar::i:
return true;
default:
return false;
}
}
inline bool FormatConversionCharIsIntegral(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::d:
case FormatConversionChar::i:
case FormatConversionChar::u:
case FormatConversionChar::o:
case FormatConversionChar::x:
case FormatConversionChar::X:
return true;
default:
return false;
}
}
inline bool FormatConversionCharIsFloat(FormatConversionChar c) { inline bool FormatConversionCharIsFloat(FormatConversionChar c) {
switch (c) { switch (c) {
case FormatConversionChar::a: case FormatConversionChar::a:
......
...@@ -254,8 +254,8 @@ class FormatCountCapture { ...@@ -254,8 +254,8 @@ class FormatCountCapture {
// argument, etc. // argument, etc.
template <typename... Args> template <typename... Args>
using FormatSpec = using FormatSpec = str_format_internal::FormatSpecTemplate<
typename str_format_internal::FormatSpecDeductionBarrier<Args...>::type; str_format_internal::ArgumentToConv<Args>()...>;
// ParsedFormat // ParsedFormat
// //
......
...@@ -246,10 +246,10 @@ absl_cc_library( ...@@ -246,10 +246,10 @@ absl_cc_library(
"internal/conformance_aliases.h" "internal/conformance_aliases.h"
"internal/conformance_archetype.h" "internal/conformance_archetype.h"
"internal/conformance_profile.h" "internal/conformance_profile.h"
"internal/conformance_testing.h", "internal/conformance_testing.h"
"internal/conformance_testing_helpers.h", "internal/conformance_testing_helpers.h"
"internal/parentheses.h", "internal/parentheses.h"
"internal/transform_args.h", "internal/transform_args.h"
COPTS COPTS
${ABSL_DEFAULT_COPTS} ${ABSL_DEFAULT_COPTS}
DEPS DEPS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment