Commit Graph

1004 Commits

Author SHA1 Message Date
Abseil Team
16af2bbcb9 Fix "unsafe narrowing" warnings in absl, 2/n.
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare

(This specific CL focuses on .cc files in dirs a-h.)

Bug: chromium:1292951
PiperOrigin-RevId: 464541951
Change-Id: If23b63ccea8e9b730159ff1c7288e9300a40b6bd
2022-08-01 08:30:25 -07:00
Saleem Abdulrasool
dc370a8246 debugging: honour STRICT_UNWINDING in RISCV path
The changes in d6f96eda14 enabled handling cases
where the stack may be non-contiguous or not fully symbolicated (e.g. in cases
of alternate signal stacks).  However, it did not properly honour the requests
from the caller to perform a strict unwinding where such frames are terminated
upon the discontinuity.  This repairs that condition.

Hoist the alignment check since that is safe to perform early.

PiperOrigin-RevId: 464160529
Change-Id: Ic65645928ec60c2a3b4844f3abd4fed1b991edab
2022-07-29 14:39:07 -07:00
Abseil Team
7f51ef5ed2 Fix "unsafe narrowing" warnings in absl, 1/n.
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare

(This specific CL focuses on .h and win32 .inc files.)

Bug: chromium:1292951
PiperOrigin-RevId: 463835431
Change-Id: If8e5f7f651d5cd96035e23e4623bdb08a7fedabe
2022-07-28 07:46:07 -07:00
Evan Brown
c7e60ccfcd Add ABSL_IS_TRIVIALLY_RELOCATABLE and ABSL_ATTRIBUTE_TRIVIAL_ABI macros for use with clang's __is_trivially_relocatable and [[clang::trivial_abi]].
PiperOrigin-RevId: 463668740
Change-Id: I2d2d2f53d8184a7e4f7c848c2a5f5140c2481d72
2022-07-27 13:46:14 -07:00
Copybara-Service
51f6d868c8 Merge pull request #1223 from ElijahPepe:fix/implement-snprintf-safely
PiperOrigin-RevId: 463581990
Change-Id: I47359d4d2d2fcd2365b5ff9a5c3b61b5751e4ed2
2022-07-27 07:36:45 -07:00
Abseil Team
b0787ae6bc Fix frame pointer alignment check.
The frame pointer sanity check in NextStackFrame() was more restrictive than it is necessary. The frame pointer is used to load the saved link-register and the address for the next stack frame. So it only needs to be 8-byte aligned. The aarch64 ABI does not specify an alignment requirement for the frame point.

PiperOrigin-RevId: 463368519
Change-Id: I473e05181603288f14734fe29013900c7505e201
2022-07-26 10:16:30 -07:00
Abseil Team
63c9eeca04 Fixed sign-conversion warning in code.
PiperOrigin-RevId: 463214218
Change-Id: I54a37fd9560b480f9eaf0454670eacf875015fe8
2022-07-25 17:20:35 -07:00
Abseil Team
d0e7a8ab3a Import of CCTZ from GitHub.
PiperOrigin-RevId: 463153060
Change-Id: I6d24915c52bfe6507864df30aad99ba4fea2ea68
2022-07-25 12:44:10 -07:00
Abseil Team
701185dbce Add missing include for std::unique_ptr
PiperOrigin-RevId: 462681925
Change-Id: Ic5610cb4124b7f60a00817ca2f1d52674b27c168
2022-07-22 12:42:19 -07:00
David Majnemer
c1deed2f44 Do not re-close files on EINTR
POSIX is unclear what state a file descriptor is in after a signal is delivered in the middle of close. On Linux, the file is closed even if it returns -1 with errno=EINTR.

As such, do not use errno at all when closing files.

PiperOrigin-RevId: 462638735
Change-Id: Ie73da1f3c83b1099bef146e1ea32e9a4818597cf
2022-07-22 09:25:04 -07:00
Elijah Conners
0e0d8054dc fix: properly create the b integer
Signed-off-by: Elijah Conners <business@elijahpepe.com>
2022-07-21 13:18:12 -07:00
Andy Getzendanner
2c489bb5f0 Renamespace absl::raw_logging_internal to absl::raw_log_internal to match (upcoming) non-raw logging namespace.
PiperOrigin-RevId: 462213222
Change-Id: I3b9371097b368d55cc86b6106d6dec24ce122762
2022-07-20 13:11:43 -07:00
Elijah Conners
68da198e67 fix(mutex): safely call snprintf
In the PostSynchEvent() function, the pos integer uses an implementation
of snprintf that is fundamentally unsafe: since the return value of
snprintf is the number of characters that would have been written to the
buffer, if an operation reaches the end of the buffer with more than one
character discarded, the return value will be greater than the buffer
size, requiring a check of the buffer's current size.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
2022-07-19 22:37:47 -07:00
David Majnemer
0c8bd82e90 Check for negative return values from ReadFromOffset
In some places, we check if the amount we read is a multiple of some amount we are interested in. However, ReadFromOffset returns -1 when it errors. Certain record sizes can cause ReadFromOffset to cause us to think that we succeeded when we did not.

It also results in confusing messages in logs.

PiperOrigin-RevId: 461798762
Change-Id: I8c9c7f2cea4d1789e95e50833d5405239a47f02e
2022-07-18 22:25:22 -07:00
Abseil Team
e633c71109 Use HTTPS RFC URLs, which work regardless of the browser's locale.
PiperOrigin-RevId: 461737981
Change-Id: Iefb1d703725f0a258b5ee315c55277b261b75418
2022-07-18 16:06:04 -07:00
Benjamin Barenblat
65ac1e611c Avoid signedness change when casting off_t
Some ABSL_RAW_LOG statements print off_t values by casting them to
uintmax_t. However, POSIX says off_t is signed [1], so intmax_t is more
appropriate. Replace casts and format specifiers as needed.

[1] https://pubs.opengroup.org/onlinepubs/009696899/basedefs/sys/types.h.html#:~:text=off_t%20shall,%20types%2e

PiperOrigin-RevId: 461684406
Change-Id: I09ec1a3ba49cd688670618797943a84bc48dba3e
2022-07-18 12:24:41 -07:00
Martijn Vels
6162604bee Internal Cleanup: removing unused internal function declaration.
PiperOrigin-RevId: 461616203
Change-Id: I4cf2e0738451a0471bb8341d9af003d271331fab
2022-07-18 07:38:05 -07:00
Abseil Team
5d9b8a9fb0 Make Span complain if constructed with a parameter that won't outlive it, except if that parameter is also a span or appears to be a view type.
PiperOrigin-RevId: 461612357
Change-Id: Ibba36f44465176db47dd21e1866134549143fa64
2022-07-18 07:18:09 -07:00
Dino Radakovic
56f5477f15 any_invocable_test: Re-enable the two conversion tests that used to fail under MSVC
PiperOrigin-RevId: 461238101
Change-Id: Id3edac104ecd9edd9daf8012894a62692bd9569f
2022-07-15 14:26:56 -07:00
Martijn Vels
b707b6c179 Add GetCustomAppendBuffer method to absl::Cord
The Cord::GetCustomAppendBuffer() method provides the same functionality as Cord::GetAppendBuffer(), except that callers can specify a custom block size/limit if the method returns a newly allocated buffer.

In other words: Cord::GetAppendBuffer() defaults to CordBuffer::CreateWithDefaultLimit(), Cord::GetCustomAppendBuffer() defaults to CordBuffer::CreateWithCustomLimit().

PiperOrigin-RevId: 461231989
Change-Id: I5c03f31139d9b068feee1bea76d59e1c5e30ef07
2022-07-15 13:40:26 -07:00
Saleem Abdulrasool
d6f96eda14 debugging: add hooks for checking stack ranges
Add a hook to permit checking whether an address is in bounds for the stack.

PiperOrigin-RevId: 460997074
Change-Id: Ib3b4d0cf656e614aa083457abb079c40ef8db0ff
2022-07-14 10:35:00 -07:00
Abseil Team
ef68bd3d31 Minor clang-tidy cleanups
using decl 'Pointee' is unused
missing #include <utility> for 'std::move'
missing #include <memory> for 'std::unique_ptr'

PiperOrigin-RevId: 460980847
Change-Id: I5ebfca39d6b93ef396b32d1b91a5d8748d43e018
2022-07-14 09:32:02 -07:00
Abseil Team
305a0088ce Support [[gnu::abi_tag("xyz")]] demangling.
PiperOrigin-RevId: 460752575
Change-Id: I9629504b5c63dbfe367cd55e287a782cd8fa546c
2022-07-13 10:42:43 -07:00
Abseil Team
d2422b19e9 Fix -Warray-parameter warning
Clang recently added this warning which flags inconsistencies between
array parameters in function declarations.

See https://crbug.com/1343303

PiperOrigin-RevId: 460725261
Change-Id: I57b1e99f13698c947e948c6024e3f6f4642ea189
2022-07-13 08:44:42 -07:00
Copybara-Service
3d0956d139 Merge pull request #1217 from anpol:macos-sigaltstack
PiperOrigin-RevId: 460713135
Change-Id: If7ea94f409edc1e4024d7eaa4ae025b0b258fc02
2022-07-13 07:47:44 -07:00
Andrei Polushin
0565e00b93 Disable sigaltstack() on macOS to make backtrace() work.
There are many reports that sigaltstack() on Apple platforms stops
backtrace() from tracing an original stack, e.g.

* d39ead4105
* https://reviews.llvm.org/D28265

If we disable an alternate stack for signal handler, we won't be able to
catch stack overflow errors, but backrace() will work again.
2022-07-13 15:29:25 +07:00
Abseil Team
e517aaf499 Undo documentation change on erase.
PiperOrigin-RevId: 460555564
Change-Id: Icaf08bd252be12717f922e72a70a201bc1957154
2022-07-12 14:40:18 -07:00
Abseil Team
52e905e760 Improve documentation on erase.
PiperOrigin-RevId: 460509198
Change-Id: I6d85443cc3f568230f3a3d46b63358129654ddb9
2022-07-12 11:20:42 -07:00
Copybara-Service
90099691ac Merge pull request #1216 from brjsp:master
PiperOrigin-RevId: 460478343
Change-Id: I58e2e1fb7b1776f37b1254ba5fd74d56b44cb4d0
2022-07-12 09:12:37 -07:00
Derek Mauro
504229dfa4 string_view: conditional constexpr is no longer needed for C++14
PiperOrigin-RevId: 460407142
Change-Id: I9501d2e79cf8c20c5261ab0169bd4bbc3b02980c
2022-07-12 02:10:39 -07:00
Bruno Pitrus
09e9604999 Do not leak -maes -msse4.1 into pkgconfig 2022-07-11 18:27:39 +02:00
Abseil Team
427d8f5756 Make exponential_distribution_test a bigger test (timeout small -> moderate).
This test indicates it has a 90% chance of timing out at its current 60 second limit.

Stats over 1000 runs: max = 102.5s, min = 40.4s, avg = 71.1s, dev = 11.2s

Note that if you run this test locally from a workstation without flags, it'll take maybe 3 to 5 seconds.  However, the test is run with config of android_arm, which seems to drastically change the execution time.

PiperOrigin-RevId: 459503103
Change-Id: I7b7aaa2db7880370f47d1a83d295a3234f738a18
2022-07-07 07:01:15 -07:00
Derek Mauro
97ab3dcfd6 Move Abseil to C++14 minimum
Adds policy checks the raise the minimum C++ version to C++14
and the minimum GCC version to GCC 5

Updates the docs to indicate the C++14 minimum.

PiperOrigin-RevId: 459401288
Change-Id: I18878f0e13001c57e97e26ad7c9a9c9c12c39265
2022-07-06 19:09:41 -07:00
Saleem Abdulrasool
9edef2349c Revert commit f4988f5bd4
This seems to have caused some regressions by causing a flaky failure in some
cases.  Revert the change to enable investigation.

PiperOrigin-RevId: 459331687
Change-Id: Iaa4e4bfcb3013a75a2cd72768d980ac5e450f70c
2022-07-06 13:40:46 -07:00
Derek Mauro
4bbdb02689 Disable C++11 testing, enable C++14 and C++20 in some configurations
where it wasn't enabled

PiperOrigin-RevId: 459092217
Change-Id: I4500bba8a09f4b320610a8170a26e93fdf7e0cab
2022-07-05 09:39:15 -07:00
Saleem Abdulrasool
f4988f5bd4 debugging: account for differences in alternate signal stacks
The alternate signal stack may be sufficiently beyond the esimated frame size
(100k).  If we run into the case that the frame is not in the correct direction
assume that the frames may be non-contiguous due to an alternate signal stack
layout.  In such a case, if we find that there is an alternate stack configured,
ignore the discontiuity (assuming that it is a removable point-wise
discontinuity) and continue the stack unwinding.  This permits us to capture
stack traces in more cases.

PiperOrigin-RevId: 458327775
Change-Id: Ia8b461847401492f72a23ba26601c72e0109402c
2022-06-30 15:36:12 -07:00
Abseil Team
b35ae3281a Import of CCTZ from GitHub.
PiperOrigin-RevId: 457997580
Change-Id: I39d007d4f93c02e07ad660df13d9f63e786182f8
2022-06-29 09:43:43 -07:00
Abseil Team
736458b555 Run flaky test in fewer configurations
PiperOrigin-RevId: 457234764
Change-Id: I7d543bc8e4e01d7739f1a3a2cf602ed3e1ea84d3
2022-06-25 14:03:13 -07:00
Dino Radakovic
c46096c507 AnyInvocable: Move credits to the top of the file
PiperOrigin-RevId: 457014105
Change-Id: I4ecd4185385a213838c6f3241b65536b1f833705
2022-06-24 08:12:06 -07:00
Gennadiy Rozental
388c2edaf1 Extend visibility of :examine_stack to an upcoming Abseil Log.
PiperOrigin-RevId: 457005885
Change-Id: I9045ca94a3695303274d7c448b25e32fe02f3383
2022-06-24 07:19:09 -07:00
Abseil Team
4dc63bade3 Merge contiguous mappings from the same file.
This allows symbolization to work if different parts of a binary's text are mapped differently, e.g. if they're mlock()ed or mapped onto huge pages.

PiperOrigin-RevId: 456600880
Change-Id: I069264f94cf834df9201968275a00828f5eb077e
2022-06-22 13:56:07 -07:00
Derek Mauro
e7cbb2acd3 Update versions of WORKSPACE dependencies
PiperOrigin-RevId: 456549823
Change-Id: Iee19597c63a653b8562168367d5860cf8421b6ae
2022-06-22 10:39:53 -07:00
Abseil Team
8e27a61883 Use ABSL_INTERNAL_HAS_SSE2 instead of __SSE2__
This ensures that emmintrin.h is included with clang-cl. Otherwise, errors like
this occur:
.../absl/container/internal/raw_hash_set.h(536,8): error: unknown type name '__m128i'
inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) {

This aligns the include ifdef guards and the guards that use the provided APIs.
The includes are also reordered, so they appear after the config header which
provides the internal macro values.

PiperOrigin-RevId: 456530271
Change-Id: I86dfd0022fd06fe7aa132138ec4d1bd14a86ba84
2022-06-22 09:15:57 -07:00
Fabrice Fontaine
01cc6567cf PR #1200: absl/debugging/CMakeLists.txt: link with libexecinfo if needed
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1200

`backtrace` and `execinfo.h` can be provided by libexecinfo on uclibc and musl resulting in the following build failure with any user of abseil-cpp (such as collectd):

```
/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/buildroot/autobuild/instance-0/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libabsl_stacktrace.so: undefined reference to `backtrace'
```

[...]

```
    libgrpc++ . . . . . . no (libgrpc++ not found)
```

[...]

```
configure: error: "Some plugins are missing dependencies - see the summary above for details"
```

Fixes:
 - http://autobuild.buildroot.org/results/6a0484412f020e763ce3ad5bda48f09c78645bff

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Merge dac52cd20e into 93ad4284ac

Merging this change closes #1200

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1200 from ffontaine:master dac52cd20e
PiperOrigin-RevId: 456323163
Change-Id: I3d2206761524d36e2b227c571e2e513f6840ff75
2022-06-21 12:28:27 -07:00
Derek Mauro
93ad4284ac Update GCC floor container to use Bazel 5.2.0
PiperOrigin-RevId: 456261906
Change-Id: I203199daa1687f54406be4583c2fd400bdbde2cd
2022-06-21 08:09:12 -07:00
Derek Mauro
d2c5297a3c Update GoogleTest version used by Abseil
As part of this update, GoogleTest is now using the Abseil flags
implementation, and the flags usage_test needs to be modified to pass.

If building with bazel and --define=absl=1 to force GoogleTest to use
Abseil, a WORKSPACE dependency on the abseil branch of the RE2 project
is now required.

PiperOrigin-RevId: 455512245
Change-Id: I2025df0c86006fac97a80713524c9d0aae8b358e
2022-06-16 18:46:33 -07:00
Dino Radakovic
b7ceff06d2 Release absl::AnyInvocable
AnyInvocable is a C++11 compatible equivalent of the C++23 [std::move_only_function](https://en.cppreference.com/w/cpp/utility/functional/move_only_function/move_only_function).
Although this implementation matches an intermediate draft revision of the standard (http://wg21.link/p0288r5), it is neither a standard tracking type nor a seamless backfill type.

PiperOrigin-RevId: 455494585
Change-Id: If01565f8eecc78eee38fb794ef142b32b31abc7c
2022-06-16 16:43:07 -07:00
Fabrice Fontaine
53a90f079a PR #1197: absl/base/internal/direct_mmap.h: fix musl build on mips
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1197

Fix the following musl build failure on mips:

```
In file included from /nvmedata/autobuild/instance-15/output-1/build/libabseil-cpp-20211102.0/absl/base/internal/low_level_alloc.cc:26:
/nvmedata/autobuild/instance-15/output-1/build/libabseil-cpp-20211102.0/absl/base/internal/direct_mmap.h:49:10: fatal error: sgidefs.h: No such file or directory
   49 | #include <sgidefs.h>
      |          ^~~~~~~~~~~
```

Fixes:
 - http://autobuild.buildroot.org/results/3fa027e602bacb22316fb5d9b233baa0b0f0e845

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Merge c9b5b5c547 into a184bab83f

Merging this change closes #1197

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1197 from ffontaine:master c9b5b5c547
PiperOrigin-RevId: 455467767
Change-Id: I1905f7d70e914288bc1524a52adce3476a779fd8
2022-06-16 14:29:34 -07:00
Dino Radakovic
c3c49150cc absl/base/internal/invoke: Ignore bogus warnings on GCC >= 11
PiperOrigin-RevId: 455463553
Change-Id: Ifa6c238556339dd4e36715ac040ca048f2f84a9a
2022-06-16 14:09:51 -07:00
Dino Radakovic
44050f0d60 Revert GoogleTest version used by Abseil to commit 28e1da21d8d677bc98f12ccc7fc159ff19e8e817
Using GoogleTest at 0320f517fd920866d918e564105d68fd4362040a breaks Windows DLLs.

PiperOrigin-RevId: 455452411
Change-Id: Iff89a01351c01487786a22701efedf25860fadf9
2022-06-16 13:18:04 -07:00