summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest-port.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4505 from to01z:add-winapi-partition-games-supportCopybara-Service2024-04-031-10/+10
|\ | | | | | | | | PiperOrigin-RevId: 621631167 Change-Id: I0790f7082ce3c20fef92958c820d40ec854fe91d
| * Add support for compiling GoogleTest for XboxTroels Gram2024-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for Xbox platforms, requires the code to support compilation with the WINAPI_FAMILY_GAMES subset of the Win32 API. - Add support for WINAPI_FAMILY_GAMES to enable GTEST_OS_WINDOWS_GAMES platform. - Disable stream redirection (GTEST_HAS_STREAM_REDIRECTION = 0) and colored TTY printing for GTEST_OS_WINDOWS_GAMES platform. Both features currently require Win32 functions that don't exist in the WINAPI_FAMILY_GAMES subset. Misc fixes: - gtest-port.cc: Move GTEST_DISABLE_MSC_DEPRECATED_PUSH_ into GTEST_HAS_STREAM_REDIRECTION conditional section where the corresponding GTEST_DISABLE_MSC_DEPRECATED_POP_ is located. - googletest-port-test.cc: Switch stream redirection tests to be conditional on GTEST_HAS_STREAM_REDIRECTION instead of !defined(GTEST_OS_WINDOWS_MOBILE).
* | Fix a race condition between the Watcher thread and the main threadDerek Mauro2024-04-031-10/+25
|/ | | | | | | | | | | | | | | | during program exit A race condition exist between the Watcher thread and main(). A case was found where the Watcher thread does not get execution time before the main function returns and calls atexit(). At that point the Watcher thread started runing tls_init() code while the main thread was shutting down. This resulted in rare crashes and deadlocks. Fixes #4493 Closes #4494 PiperOrigin-RevId: 621619768 Change-Id: I66f00d8f0f3c37f9937c6d13890f7fa10038256d
* Fix RE::Init for Android and NetBSD.Abseil Team2023-10-051-2/+13
| | | | | | | | | This is a somewhat recent change for Android (I'm not clear on whether it's a recent change for NetBSD, or if Android was just very behind on its implementation), so while this worked fine as recently as API 32 devices, REG_GNU is required for API 34 (API 33 untested). A test actually caught this, but https://github.com/google/googletest/pull/4334 "fixed" the test rather than the implementation. This CL also reverts the test change so it can catch the failure. PiperOrigin-RevId: 571126374 Change-Id: I420dfcedea58f2c8b605f699515d744006c0a9d9
* Merge pull request #4342 from tanzislam:prefer-tmpdir-on-androidCopybara-Service2023-09-141-8/+24
|\ | | | | | | | | PiperOrigin-RevId: 565230380 Change-Id: I6e91eea46d05413d4d87e73a11941786604d9f27
| * Reuse TempDir() functionrefs/pull/4342/headTanzinul Islam2023-08-261-4/+1
| |
| * Prefer $TMPDIR to /data/local/tmp on AndroidTanzinul Islam2023-08-181-1/+7
|/ | | Newer devices can have the latter location read-only. (I observed this with Termux on a non-rooted Pixel 6.)
* This trips up when compiling with -Wvla otherwise.Abseil Team2023-05-051-2/+2
| | | | | PiperOrigin-RevId: 529762901 Change-Id: I6ce4d630191bf265f847aef2d5dcc12a712faa60
* Add missing std includesTom Hughes2023-04-201-0/+4
| | | | | PiperOrigin-RevId: 525850646 Change-Id: I64387f5b933beb79cd05636dca81b7a75213383e
* Use "#ifdef" with public macrosTom Hughes2023-03-061-3/+3
| | | | | | | This allows compilation with "-Wundef" (#3267). PiperOrigin-RevId: 513944726 Change-Id: I1a3854bb2333d5dec6c0ff91ee1eddd9a766ab91
* Use "#ifdef GTEST_OS_..." instead of "#if GTEST_OS_..."Tom Hughes2023-03-061-26/+28
| | | | | | | This is compatible with compiling with "-Wundef" (#3267). PiperOrigin-RevId: 513943378 Change-Id: I47cf5fabbb77be061c4483a0adc54511af6b191c
* Remove strdup usageAbseil Team2023-02-151-25/+17
| | | | | PiperOrigin-RevId: 509947007 Change-Id: I31e1274afa889776829c877c40c9af589298dcf2
* Merge pull request #3863 from eidosmontreal:fix_unused-variable_warningCopybara-Service2022-06-141-9/+9
|\ | | | | | | | | PiperOrigin-RevId: 454940948 Change-Id: Ic87dadfe9c6fc8882b0f425aa2056f0cc7a90b55
| * Move declaration of kStdOutFileNo and kStdErrFilenorefs/pull/3863/headGaspard Petit2022-06-111-11/+9
| | | | | | | | Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice
| * Fix "unused variable" warningGaspard Petit2022-05-301-0/+2
|/ | | | Fix "unused variable" warning when GTEST_HAS_STREAM_REDIRECTION is set to false in gtest-port.cc
* Remove the legacy internal GTEST_DISALLOW_* macrosDerek Mauro2022-04-221-3/+6
| | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* Running clang-format over all of GoogleTestAbseil Team2022-03-151-157/+135
| | | | | | | | | | | | | | | | A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d
* Suppress unused-value warningrefs/pull/3672/headDenis Samoilov2021-11-171-2/+2
| | | | | When _DEBUG is not defined the _CrtSetDbgFlag turns into ((int)0), which causes unused-value warning for clang.
* Merge pull request #3657 from BioDataAnalysis:bda_add_winerrdinord2021-11-101-1/+2
|\ | | | | | | PiperOrigin-RevId: 408896910
| * googletest/src/gtest-port.cc: Added GetLastError() on Windows for CreateThread()refs/pull/3657/headMario Emmenlauer2021-11-101-1/+2
|/
* Googletest exportdmauro2021-11-031-4/+0
| | | | | | | Remove GoogleTest's SleepMilliseconds function. It is only used in tests and a portable implementation is available. PiperOrigin-RevId: 405437102
* Googletest exportdmauro2021-11-031-17/+0
| | | | | | | | | | Replace the multiple implementations of Notification with a single portable implementation. The also removes the awkward loop with sleep in Notification and will allow the removal of SleepMilliseconds. PiperOrigin-RevId: 405399733
* Merge pull request #3200 from ellert:port-to-GNU/HurdCJ Johnson2021-06-171-1/+1
|\ | | | | | | PiperOrigin-RevId: 379383941
| * Port to GNU/Hurdrefs/pull/3200/headMattias Ellert2020-12-301-1/+1
| |
* | Googletest exportAbseil Team2021-05-251-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the dependency on Objective C++ in iOS builds. 252ce9c52d304659eff6be558209c811b7191963 introduced the use of NSTemporaryDirectory() on iOS, which requires Core Foundation, and Objective C++. This CL replaces NSTemporaryDirectory() with an equivalent solution (according to Apple's documentation at [1]) available to C/C++ code. Avoiding Objective C++ and Core Foundation makes it easier to integrate googletest in projects that can't use the supplied Bazel build files. [1] https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585-SW10 PiperOrigin-RevId: 375474990
* | Googletest exportAbseil Team2021-04-261-1/+11
|/ | | | | | Fix iOS logging issues in tests PiperOrigin-RevId: 370484087
* fix compilation on OpenBSD 6.7refs/pull/2872/headEli Lindsey2020-05-301-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building on OpenBSD 6.7 current fails due to implicit numeric conversions: OpenBSD clang version 8.0.1 (tags/RELEASE_801/final) (based on LLVM 8.0.1) Target: amd64-unknown-openbsd6.7 Thread model: posix InstalledDir: /usr/bin In file included from /tmp/u/build/_deps/googletest-src/googletest/src/gtest-all.cc:45: /tmp/u/build/_deps/googletest-src/googletest/src/gtest-port.cc:201:19: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion] mib[5] = size / mib[4]; ~ ^~~~~~ /tmp/u/build/_deps/googletest-src/googletest/src/gtest-port.cc:211:33: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion] for (size_t i = 0; i < size / mib[4]; i++) { ~ ^~~~~~ /tmp/u/build/_deps/googletest-src/googletest/src/gtest-port.cc:215:10: error: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion] return nthreads; ~~~~~~ ^~~~~~~~ /tmp/u/build/_deps/googletest-src/googletest/src/gtest-port.cc:201:17: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32] mib[5] = size / mib[4]; ~ ~~~~~^~~~~~~~ 4 errors generated.
* fix signed/unsigned comparison issue (on OpenBSD)refs/pull/2810/headJuergen Bohl2020-04-121-1/+1
|
* Merge pull request #2570 from xieyubo:1.10Gennadiy Civil2019-11-221-0/+3
|\ | | | | | | PiperOrigin-RevId: 281971090
| * Fix internal memory leak in Windows _Crt report.refs/pull/2571/headrefs/pull/2570/headxyb2019-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use "MemoryIsNotDeallocated" to aovid internal expected leak reported in Windows _Crt report, like: { #ifdef _MSC_VER MemoryIsNotDeallocated memory_is_not_deeallocated; #endif static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals(); return map; } But int the above code, only "new ThreadIdToThreadLocals()" is protected, if we invoke "insert()" function of the return value, the memory allocated in "insert()" will be reported to _Crt report also. This change try to fix this issue.
* | Googletest exportAbseil Team2019-11-221-6/+7
|/ | | | | | | | | | | | | Use standard C++11 integer types in gtest-port.h. Remove testing::internal::{Int,Uint}{32,64} in favor of types guaranteed to be in <cstdint> since C++11. Tests for built-in integer type coverage are switched from {Int,Uint}64 to [unsigned] long long, which is guaranteed by C++11 to exist and be at least 64-bit wide. PiperOrigin-RevId: 281565263
* Googletest exportAbseil Team2019-09-271-7/+4
| | | | | | | | | | | | | | Use a more portable path for Android to write temp files to. /sdcard is *not* guaranteed to be available, but /data/local/tmp is. In some emulated situations, /sdcard may not be mounted, may not be R/W, or mounting may be delayed until *after* the test process begins. This is fairly common location to use. See e.g.: https://reviews.llvm.org/D9569 PiperOrigin-RevId: 270909282
* restore mistakenly removed iffs in their explicit formrefs/pull/2387/headKrystian Kuzniarek2019-08-201-18/+18
| | | | | Due to confusion arisen from "iff" standing for "if and only if", this commit uses the latter.
* fix typosrefs/pull/2356/headKrystian Kuzniarek2019-07-301-12/+12
|
* Googletest exportAbseil Team2019-05-301-0/+9
| | | | | | Add a safety nullptr check to catch the case where the /tmp file used for capturing a stream cannot be created. PiperOrigin-RevId: 250523012
* Address fallout from -Wsign-conversion work on Windowsrefs/pull/2241/headEnji Cooper2019-04-261-1/+1
| | | | | | | | Some Windows users builds were broken after a0d60be. This change addresses the lingering -Wsign-conversion issues with those platforms by adding some missing `static_cast` calls as needed. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* clang: fix `-Wsign-conversion` errorsEnji Cooper2019-04-061-2/+2
| | | | | | | | | | | Cast some values as their unsigned equivalents or `size_t` to match the parameter type used for the template object under test. Also, provide UInt32 equivalent delegate methods for some callers (with int-equivalents for backwards compatibility). This closes #2146. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Googletest exportAbseil Team2019-04-011-7/+0
| | | | | | | | Remove support for "global" ::string and ::wstring types. This support existed for legacy codebases that existed from before namespaces where a thing. It is no longer necessary. PiperOrigin-RevId: 241335738
* Remove old_crtdbg_flag_ member if not requiredTobias Müller2019-03-191-4/+6
|
* Import `patch-bsd-defines` from FreeBSD ports [1]Enji Cooper2019-02-131-0/+83
| | | | | | | | | | As noted in the patch description: * Add DragonFly and GNU/kFreeBSD support. * Implement GetThreadCount() for BSDs. 1. https://svnweb.freebsd.org/ports/head/devel/googletest/files/patch-bsd-defines?revision=488934 Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Googletest exportmisterg2019-01-021-7/+0
| | | | | | Internal Change PiperOrigin-RevId: 227575279
* Googletest exportmisterg2018-10-311-2/+2
| | | | | | Remove scoped_ptr replace with std::unique_ptr PiperOrigin-RevId: 219291284
* Merge pull request #1941 from barkovv:masterGennadiy Civil2018-10-291-33/+31
|\ | | | | | | PiperOrigin-RevId: 219134349
| * Replaced all NULLs with nullptr in googletestVadim Barkov2018-10-281-29/+29
| |
* | Googletest exportmisterg2018-10-291-5/+7
|/ | | | | | Remove linked_ptr and use std::shared_ptr instead PiperOrigin-RevId: 219129336
* Googletest exportAbseil Team2018-10-261-7/+5
| | | | | | Remove linked_ptr and use std::shared_ptr instead PiperOrigin-RevId: 218618184
* Googletest exportmisterg2018-10-261-5/+7
| | | | | | Remove linked_ptr and use std::shared_ptr instead PiperOrigin-RevId: 218571466
* Merge 41fc9745d4a448db7d932250d22fac1dda287443 into ↵Aaron Dierking2018-10-111-0/+3
| | | | | | | | 658c6390a5b363f46c6ad448ad1bce9d6e97e53a Accepts #1889 PiperOrigin-RevId: 216709878
* Apply clang-tidy modernize-use-nullptr to googletest.Abseil Team2018-10-051-13/+14
| | | | | | | | | | | Now that googletest has moved to C++11, it should no longer use NULL or 0 for the null pointer. This patch converts all such usages to nullptr using clang-tidy. This prevents LLVM from issuing -Wzero-as-null-pointer-constant warnings. PiperOrigin-RevId: 215814400
* Small style changes. refs/pull/1142/headGennadiy Civil2018-08-161-14/+8
| | | Just small style changes and we can accept this PR