diff options
author | Abseil Team <absl-team@google.com> | 2018-11-15T19·55-0800 |
---|---|---|
committer | Jon Cohen <cohenjon@google.com> | 2018-11-15T20·05-0500 |
commit | a06c4a1d9093137b7217a5aaba8920d62e835dc0 (patch) | |
tree | d4f1d5291bbf6bcf97d415d0f08a629cef66b3f1 /absl/base | |
parent | 7b46e1d31a6b08b1c6da2a13e7b151a20446fa07 (diff) |
Export of internal Abseil changes.
-- 5f1ab09522226336830d9ea6ef7276d37f536ac5 by Abseil Team <absl-team@google.com>: Clarify the documentation of ABSL_MUST_USE_RESULT. PiperOrigin-RevId: 221663609 -- af4c8359a20d56369fd1dce318220cf3be03ca66 by Greg Falcon <gfalcon@google.com>: Internal change PiperOrigin-RevId: 221538448 -- 487cd09bd1942bf607080deeae38fee6ce66f294 by Eric Fiselier <ericwf@google.com>: Work around emscripten bugs and missing features in absl/time:time_test. The emscripten toolchain has a couple of issues that cause time_test to fail. Specifically: 1) emscripten doesn't support signals. 2) The javascript implementation of strftime/strptime use different expansions of '%c' that mean it doesn't round-trip. PiperOrigin-RevId: 221523701 -- 5823652e6a200b97b07334bc47128dfac40e20fc by Xiaoyi Zhang <zhangxy@google.com>: Fix MSVC compiler warning by explicitly casting to char. Currently our MSVC build breaks with the following error: raw_hash_set.h(406): warning C4309: 'argument': truncation of constant value PiperOrigin-RevId: 221492585 -- c5806358320711a5efbe5c523df13e14ab53a17d by Greg Falcon <gfalcon@google.com>: Replace calls to getpagesize() with the more portable sysconf(_SC_PAGESIZE); the latter is in POSIX 1.0 and is called out in the Linux `getpagesize` man page as a more portable spelling. PiperOrigin-RevId: 221492471 -- 19ffe82851072229bb7ce73f754ffe4c18e8c575 by Abseil Team <absl-team@google.com>: Fix -Wundef error in absl/hash/internal/hash.h. PiperOrigin-RevId: 221444120 -- b30f3d0a848563b6e4ec33f3dc085831dfabb748 by Jon Cohen <cohenjon@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 221339736 GitOrigin-RevId: 5f1ab09522226336830d9ea6ef7276d37f536ac5 Change-Id: I96223d522d98bf6616dea88eb047c2d536eeddd0
Diffstat (limited to 'absl/base')
-rw-r--r-- | absl/base/attributes.h | 25 | ||||
-rw-r--r-- | absl/base/config.h | 5 | ||||
-rw-r--r-- | absl/base/internal/direct_mmap.h | 2 | ||||
-rw-r--r-- | absl/base/internal/low_level_alloc.cc | 4 |
4 files changed, 25 insertions, 11 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h index c44b8828509a..291ad89ee782 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h @@ -402,17 +402,28 @@ // ABSL_MUST_USE_RESULT // -// Tells the compiler to warn about unused return values for functions declared -// with this macro. The macro must appear as the very first part of a function -// declaration or definition: +// Tells the compiler to warn about unused results. // -// Example: +// When annotating a function, it must appear as the first part of the +// declaration or definition. The compiler will warn if the return value from +// such a function is unused: // // ABSL_MUST_USE_RESULT Sprocket* AllocateSprocket(); +// AllocateSprocket(); // Triggers a warning. +// +// When annotating a class, it is equivalent to annotating every function which +// returns an instance. +// +// class ABSL_MUST_USE_RESULT Sprocket {}; +// Sprocket(); // Triggers a warning. +// +// Sprocket MakeSprocket(); +// MakeSprocket(); // Triggers a warning. +// +// Note that references and pointers are not instances: // -// This placement has the broadest compatibility with GCC, Clang, and MSVC, with -// both defs and decls, and with GCC-style attributes, MSVC declspec, C++11 -// and C++17 attributes. +// Sprocket* SprocketPointer(); +// SprocketPointer(); // Does *not* trigger a warning. // // ABSL_MUST_USE_RESULT allows using cast-to-void to suppress the unused result // warning. For that, warn_unused_result is used only for clang but not for gcc. diff --git a/absl/base/config.h b/absl/base/config.h index e3edb2bf0cb6..ca089f6d060e 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -274,7 +274,8 @@ #error ABSL_HAVE_MMAP cannot be directly set #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \ - defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) + defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \ + defined(__ASYLO__) #define ABSL_HAVE_MMAP 1 #endif @@ -328,6 +329,8 @@ #define ABSL_HAVE_ALARM 1 #elif defined(_MSC_VER) // feature tests for Microsoft's library +#elif defined(__EMSCRIPTEN__) +// emscripten doesn't support signals #elif defined(__native_client__) #else // other standard libraries diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h index 0426e11890b6..3e5368db46f5 100644 --- a/absl/base/internal/direct_mmap.h +++ b/absl/base/internal/direct_mmap.h @@ -75,7 +75,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, // On these architectures, implement mmap with mmap2. static int pagesize = 0; if (pagesize == 0) { - pagesize = getpagesize(); + pagesize = sysconf(_SC_PAGESIZE); } if (offset < 0 || offset % pagesize != 0) { errno = EINVAL; diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc index 6e636a02c5d1..015edf8dadb9 100644 --- a/absl/base/internal/low_level_alloc.cc +++ b/absl/base/internal/low_level_alloc.cc @@ -208,7 +208,7 @@ struct LowLevelAlloc::Arena { int32_t allocation_count GUARDED_BY(mu); // flags passed to NewArena const uint32_t flags; - // Result of getpagesize() + // Result of sysconf(_SC_PAGESIZE) const size_t pagesize; // Lowest power of two >= max(16, sizeof(AllocList)) const size_t roundup; @@ -325,7 +325,7 @@ size_t GetPageSize() { GetSystemInfo(&system_info); return std::max(system_info.dwPageSize, system_info.dwAllocationGranularity); #else - return getpagesize(); + return sysconf(_SC_PAGESIZE); #endif } |