Commit Graph

206 Commits

Author SHA1 Message Date
Abseil Team
ed2114e8ff Stop using C++17 type traits polyfills
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
2026-04-03 12:34:35 -07:00
Mike Kruskal
45c8989b87 Add a visibility placeholder to Abseil for Gloop.
PiperOrigin-RevId: 875292936
Change-Id: I5622f33f8d6581ca3f55783579f612e3e5c4822f
2026-02-25 12:48:48 -08:00
Derek Mauro
5088cf5194 Cleanup the uses of the polyfills absl::any, absl::optional,
absl::variant, and related types

The corresponding headers are removed from cc files, but kept in
headers to prevent breakages from transitive dependencies.

PiperOrigin-RevId: 872421685
Change-Id: I867d4c3f7c9e422289c63816d44719b0530fb0a6
2026-02-19 08:53:17 -08:00
Laramie Leavitt
17f673bb6e Add absl_nonnull annotations to absl::CommandLineFlag
PiperOrigin-RevId: 853478421
Change-Id: I895218e9f40a012338aa27d706626c435e3d1ec6
2026-01-07 17:37:55 -08:00
Laramie Leavitt
237c42c78f Convert FastTypeIdType from an alias to a struct.
PiperOrigin-RevId: 853275176
Change-Id: I03979c49739d1664ede2fa9be1034ddeb379447d
2026-01-07 08:33:11 -08:00
Derek Mauro
1037021200 Use SimpleAtob() for parsing bool flags
This is equivalent to the current logic.

PiperOrigin-RevId: 847847676
Change-Id: Ibd99b2db34fec7cd23247f6de2b22e8ea4b89a15
2025-12-22 12:24:30 -08:00
Abseil Team
17947175b5 absl:🎏 Stop echoing file content in flagfile parsing errors
Modified ArgsList::ReadFromFlagfile to redact the content of unexpected lines from error messages. \

PiperOrigin-RevId: 845327732
Change-Id: I6e0bf8f443b534cc9fa14e214e0d275e30116261
2025-12-16 10:12:02 -08:00
Abseil Team
b9a26fe1bc Add ABSL_ATTRIBUTE_LIFETIME_BOUND to Flag help generator
Since this method is only called by `NonConst` which immediately converts it to a `std::string`, this is currently safe. Add annotation nevertheless to show the contract.

This currently makes the majority of lifetime annotation suggestion provided by the lifetime analysis https://godbolt.org/z/hKvrE1hG1

PiperOrigin-RevId: 843275432
Change-Id: Ib1a0513eca944a9c7c4c612c3111bf05881c746d
2025-12-11 10:19:38 -08:00
Sam McCall
e5c6ccbc96 FlagStateInterface implementors need only support being restored once.
PiperOrigin-RevId: 819030565
Change-Id: I92ac8ce4318f8d2e575c13752e490326030ba583
2025-10-13 23:48:38 -07:00
Abseil Team
0c01ee1895 No public description
PiperOrigin-RevId: 814683950
Change-Id: Iff615b3cf6c2dca615e215757cad8a9c975d6285
2025-10-03 07:22:10 -07:00
Corentin Le Molgat
efee2e57e9 Fix __declspec support for ABSL_DECLARE_FLAG()
Fix #1817

PiperOrigin-RevId: 813902689
Change-Id: Ic3508c02d5ed2e7dc220cdf02526680ae0adbbc1
2025-10-01 14:01:27 -07:00
Chris Kennelly
d473c92b9e Inline internal usages of Mutex::Lock, etc. in favor of lock.
PiperOrigin-RevId: 789459507
Change-Id: I573dec1c33b047388509cfea129342ea7bdfe494
2025-07-31 13:51:06 -07:00
Chris Kennelly
0f1abc9b73 Inline internal usages of pointerful SpinLockHolder/MutexLock.
PiperOrigin-RevId: 789441157
Change-Id: I2ed5d12f4b9725edbe3fd6cf629a0563a2f2d739
2025-07-31 12:59:26 -07:00
Abseil Team
878361312d Automated Code Change
PiperOrigin-RevId: 783054860
Change-Id: I3f84881642f2f77be5d5275983243edf6305178c
2025-07-14 15:00:34 -07:00
Derek Mauro
7c5528251a Add absl::FastTypeId<T>()
absl::FastTypeId<Type>() evaluates at compile-time to a unique id for the
passed-in type. These are meant to be good match for keys into maps or
straight up comparisons.

Previously this was an internal implemention detail used by a few libraries.
This is now a supported utility function.

PiperOrigin-RevId: 743194478
Change-Id: Ie01ed8a2850696ee661acb91726252adb4c20538
2025-04-02 10:37:37 -07:00
Abseil Team
d79e680580 Add nullability annotations to some very-commonly-used APIs.
Manual annotation of these APIs specifically helps us avoid inferring them with tooling as having conflicted nullability due to a small number of incorrect uses out of many, many uses.

These annotations have no runtime impact.

PiperOrigin-RevId: 739258146
Change-Id: Id18bd1f0313c5b196e1d9e8ed4d1ce057dfcd582
2025-03-21 12:11:24 -07:00
CJ Johnson
930a70d12e PR #1860: Add unsigned to character buffers to ensure they can provide storage (https://eel.is/c++draft/intro.object#3)
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1860

I just learned today that `char` cannot "provide storage" in the way I previously thought. Only `std::byte` and `unsigned char` are allowed. So I decided to fix my past mistakes in `absl::InlinedVector` and `absl::Cleanup` as well as any others I could find in Abseil. See: https://eel.is/c++draft/intro.object#3

Merge ae9c1ef57a into c4ff4d561c

Merging this change closes #1860

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1860 from CJ-Johnson:master ae9c1ef57a
PiperOrigin-RevId: 739220589
Change-Id: I533b040e4cf4ee2f48008affb6603c25f34d5b4b
2025-03-21 10:11:45 -07:00
Derek Mauro
70ba73e6b1 Use absl::NoDestructor an absl::Mutex instance in the flags
library to prevent some exit-time destructor warnings

This is the convention in the rest of Abseil.

PiperOrigin-RevId: 734551159
Change-Id: I4c8eb12ea8e2b7b42605d6b587dfef2235a29b7e
2025-03-07 07:32:04 -08:00
Derek Mauro
1af129f1c3 Use C++17 [[nodiscard]] instead of the deprecated ABSL_MUST_USE_RESULT
In this change, //absl/status is intentionally excluded because of
complication with SWIG compatibility. This may be handled separately.

PiperOrigin-RevId: 731387819
Change-Id: I71bf2e02f3a477d65575d467f5e5ab163846d31e
2025-02-26 11:16:38 -08:00
Dmitry Vyukov
1cdbba70ea Provide information about types of all flags.
PiperOrigin-RevId: 717986118
Change-Id: Ib962482b66e1eac09165767d4a36a91ad49e8fc8
2025-01-21 10:54:20 -08:00
Derek Mauro
655707fb20 Use absl::NoDestructor for some absl::Mutex instances in the flags
library to prevent some exit-time destructor warnings

This is the convention in the rest of Abseil.

PiperOrigin-RevId: 716767392
Change-Id: Ie7e1df54e79eba9057fbaeea000f63b6ec9929bc
2025-01-17 12:49:38 -08:00
Derek Mauro
90a7ba66e8 Updates to CI to support newer versions of tools
Linux "latest" containers updated to
GCC 14.2
CMake 3.31.2
Bazel 8.0.0

Included are various fixes to get these versions to work.

Bazel now references repositories by their canonical names from the
Bazel Central Registry. For example, Abseil is now @abseil-cpp instead
of @com_google_absl, and GoogleTest is now @googletest instead of
@com_google_googletest. Users still using the old WORKSPACE system may
need to use `repo_mapping` on repositories using the old names. See
`WORKSPACE.bazel` in this commit for an example.

PiperOrigin-RevId: 709102146
Change-Id: I02327ed4f8fb947766480bdeef2b1930a7f831eb
2024-12-23 10:58:05 -08:00
Derek Mauro
c6b27359c3 Add workaround for q++ 8.3.0 (QNX 7.1) compiler by making
sure MaskedPointer is trivially copyable and copy constructible.

Fixes #1758

PiperOrigin-RevId: 679618900
Change-Id: Ia0ebacd8bb43b3fe3b9cd654259bef9072cec46c
2024-09-27 09:25:44 -07:00
Abseil Team
8f942c0019 Update ABSL_RETIRED_FLAG comment to reflect default_value is no longer
used.

PiperOrigin-RevId: 668612700
Change-Id: I018ce756632154a9e7f2de77e6faa24296d80002
2024-08-28 14:41:25 -07:00
Michael Brase
9bd9a2d6df Add tagging for cc_tests that are incompatible with Fuchsia
PiperOrigin-RevId: 660539039
Change-Id: I2f3dee7c60ce2234ea81c64b23e50448681fa885
2024-08-07 14:28:00 -07:00
Gennadiy Rozental
eb46a63d77 Optimize the absl::GetFlag cost for most non built-in flag types (including string).
PiperOrigin-RevId: 649200175
Change-Id: Ic6741d9fe5e0b1853ed8bb37b585d38b51d15581
2024-07-03 14:30:37 -07:00
Abseil Team
16e2195335 Remove redundant semicolons introduced by macros
PiperOrigin-RevId: 616083064
Change-Id: I3d69303d32431227c197247682f8dcb70f9a239d
2024-03-15 04:18:54 -07:00
Adam Gajda
1c233c5517 PR #1603: Disable -Wnon-virtual-dtor warning for CommandLineFlag implementations
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1603

Merge e324303b1f into d802708117

Merging this change closes #1603

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1603 from adgajda:master e324303b1f
PiperOrigin-RevId: 615522811
Change-Id: I46a388ac62ffd42ce175dbfa04e414dd498855f8
2024-03-13 13:20:57 -07:00
Gennadiy Rozental
52a711fc80 Avoid static initializers in case of ABSL_FLAGS_STRIP_NAMES=1
PiperOrigin-RevId: 603784442
Change-Id: I3d57e5f438b276c984f5d5416889b19e7ddb501a
2024-02-02 14:14:51 -08:00
Shahriar Rouf
780bfc194d Replace testonly = 1 with testonly = True in abseil BUILD files.
https://bazel.build/build/style-guide#other-conventions

PiperOrigin-RevId: 603084345
Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
2024-01-31 10:08:35 -08:00
Abseil Team
f7d2b13ef2 Remove code pieces for no longer supported GCC versions.
The minimum supported version today is GCC 7 (`__GNUC__ >= 7`).

PiperOrigin-RevId: 600475215
Change-Id: I1aa46384f1e75f268649a48dbe2b42f3475bb07f
2024-01-22 09:10:07 -08:00
Abseil Team
8bd6445acc Automated Code Change
PiperOrigin-RevId: 597297788
Change-Id: Idb4cd3f62a03204bcad423d9934963136c018996
2024-01-10 10:56:08 -08:00
Derek Mauro
4038192a57 Remove workaround for older versions MSVC that did not support
constexpr Flag construction. These versions of MSVC are no longer
supported.

PiperOrigin-RevId: 595195773
Change-Id: Iaf2f01a2255fb24f3aadc26f09600543fffa9da5
2024-01-02 13:27:33 -08:00
Andy Getzendanner
8184f16e89 Release a few bits and pieces of DFATAL that were left behind: flag parsing & some tests.
PiperOrigin-RevId: 592918704
Change-Id: Iacef0e069c012a04960211c032454244822f9634
2023-12-21 12:01:50 -08:00
Abseil Team
20f92b10d5 Use absl::NoDestructor for global FlagRegistry.
PiperOrigin-RevId: 582861689
Change-Id: Iac257539ab282e9bfdc6d90e86c8da0c0d57b9c9
2023-11-15 17:53:34 -08:00
Derek Mauro
0ef3ef4329 Bazel: Enable the header_modules feature
PiperOrigin-RevId: 572575394
Change-Id: Ic1c5ac2423b1634e50c43bad6daa14e82a8f3e2c
2023-10-11 07:58:06 -07:00
Derek Mauro
143e983739 Bazel: Support layering_check and parse_headers
The layering_check feature ensures that rules that include a header
explicitly depend on a rule that exports that header. Compiler support
is required, and currently only Clang 16+ supports diagnoses
layering_check failures.

The parse_headers feature ensures headers are self-contained by
compiling them with -fsyntax-only on supported compilers.

PiperOrigin-RevId: 572350144
Change-Id: I37297f761566d686d9dd58d318979d688b7e36d1
2023-10-10 13:30:24 -07:00
Dmitri Gribenko
9d05d379aa Include what you spell
PiperOrigin-RevId: 555894810
Change-Id: I349c94e7c6e7ba1dbd817aa8e4340c1dada84654
2023-08-11 04:25:21 -07:00
Abseil Team
d2de53124e Use a shared (reader) lock in absl_flags::WasPresentOnCommandLine
PiperOrigin-RevId: 553209806
Change-Id: I6828c3a5df1981471bca7f2f6cb16dfd60e77a96
2023-08-02 11:41:25 -07:00
Mark Barolak
25800da223 Add a comment to absl/flags/parse.cc indicating that the flags defined there are not intended to be read or set from C++ code.
PiperOrigin-RevId: 547264846
Change-Id: Idd0958f308ec74f907c22cce965fac2e06692e2c
2023-07-11 12:31:12 -07:00
Tsige Solomon
5922d12960 Bug fix
PiperOrigin-RevId: 540586646
Change-Id: Iac1e133647fbaa5036ac9ef7322f9af5886c658e
2023-06-15 08:18:26 -07:00
Abseil Team
5d1f1cf9dd Adding more support and testing for int128 and uint128 flags from cl/534444213
PiperOrigin-RevId: 539726003
Change-Id: Ie38f8d48a7b4c9d498fc1c4c4af6138048f80f68
2023-06-12 12:14:13 -07:00
Gennadiy Rozental
86aaa72a33 Update XML output to properly print special characters. Non printable characters are skipped in output. All the "whitespace-like" (including \t, \r, \n) characters printed as plain space ' '.
PiperOrigin-RevId: 538479923
Change-Id: I62dff39bb21f376d00a7b9480f8f1d31d7015e45
2023-06-07 07:25:07 -07:00
Abseil Team
e9bb35cea3 Adding support for int128 and uint128 flag types
PiperOrigin-RevId: 537120102
Change-Id: I7952e53aca10319eb433e4c4d60cf3d7fe74d19a
2023-06-01 13:52:23 -07:00
Andy Getzendanner
5274782148 Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.
The non-RAW_ versions provide better output but weren't available when most of these tests were written.

There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.

Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.

PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
2023-05-23 15:47:23 -07:00
Vertexwahn
d60c3ac625 Fix spelling mistakes 2023-05-02 20:24:15 +02:00
Vertexwahn
9c32e50df8 Fix spelling mistakes 2023-04-27 22:10:09 +02:00
Vertexwahn
421a74dce4 Fix some spelling mistakes 2023-04-24 21:25:50 +02:00
Derek Mauro
cb204d6d9c Replace absl::type_traits_internal::is_trivially_copyable with
std::is_trivially_copyable

PiperOrigin-RevId: 523724345
Change-Id: Id68c79c3bbb253d892bdef4659ac8a926e023d12
2023-04-12 09:38:31 -07:00
Gennadiy Rozental
e73b9139ee Use stdout for help output even in case of errors.
PiperOrigin-RevId: 522393331
Change-Id: Ia5f4ad6a2d16c033ea97f3c7e27e8eb7ee429242
2023-04-06 11:44:07 -07:00