diff options
Diffstat (limited to 'absl/base/internal')
-rw-r--r-- | absl/base/internal/exception_safety_testing.cc | 14 | ||||
-rw-r--r-- | absl/base/internal/exception_safety_testing.h | 14 | ||||
-rw-r--r-- | absl/base/internal/exception_testing.h | 14 | ||||
-rw-r--r-- | absl/base/internal/low_level_alloc.cc | 17 | ||||
-rw-r--r-- | absl/base/internal/low_level_alloc.h | 13 | ||||
-rw-r--r-- | absl/base/internal/low_level_alloc_test.cc | 2 | ||||
-rw-r--r-- | absl/base/internal/pretty_function.h | 14 |
7 files changed, 69 insertions, 19 deletions
diff --git a/absl/base/internal/exception_safety_testing.cc b/absl/base/internal/exception_safety_testing.cc index 32d904ed23fa..ab8d6c9fb4d0 100644 --- a/absl/base/internal/exception_safety_testing.cc +++ b/absl/base/internal/exception_safety_testing.cc @@ -1,3 +1,17 @@ +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "absl/base/internal/exception_safety_testing.h" #include "gtest/gtest.h" diff --git a/absl/base/internal/exception_safety_testing.h b/absl/base/internal/exception_safety_testing.h index 05bcd0ab59d6..a0127a8819fa 100644 --- a/absl/base/internal/exception_safety_testing.h +++ b/absl/base/internal/exception_safety_testing.h @@ -1,3 +1,17 @@ +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Utilities for testing exception-safety #ifndef ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_ diff --git a/absl/base/internal/exception_testing.h b/absl/base/internal/exception_testing.h index 99a10734842b..07d7e8ee1ba6 100644 --- a/absl/base/internal/exception_testing.h +++ b/absl/base/internal/exception_testing.h @@ -1,3 +1,17 @@ +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Testing utilities for ABSL types which throw exceptions. #ifndef ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc index 962232433665..5f047a54389a 100644 --- a/absl/base/internal/low_level_alloc.cc +++ b/absl/base/internal/low_level_alloc.cc @@ -358,18 +358,15 @@ LowLevelAlloc::Arena::Arena(uint32_t flags_value) } // L < meta_data_arena->mu -LowLevelAlloc::Arena *LowLevelAlloc::NewArena(int32_t flags, - Arena *meta_data_arena) { - ABSL_RAW_CHECK(meta_data_arena != nullptr, "must pass a valid arena"); - if (meta_data_arena == DefaultArena()) { +LowLevelAlloc::Arena *LowLevelAlloc::NewArena(int32_t flags) { + Arena *meta_data_arena = DefaultArena(); #ifndef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING - if ((flags & LowLevelAlloc::kAsyncSignalSafe) != 0) { - meta_data_arena = UnhookedAsyncSigSafeArena(); - } else // NOLINT(readability/braces) + if ((flags & LowLevelAlloc::kAsyncSignalSafe) != 0) { + meta_data_arena = UnhookedAsyncSigSafeArena(); + } else // NOLINT(readability/braces) #endif - if ((flags & LowLevelAlloc::kCallMallocHook) == 0) { - meta_data_arena = UnhookedArena(); - } + if ((flags & LowLevelAlloc::kCallMallocHook) == 0) { + meta_data_arena = UnhookedArena(); } Arena *result = new (AllocWithArena(sizeof (*result), meta_data_arena)) Arena(flags); diff --git a/absl/base/internal/low_level_alloc.h b/absl/base/internal/low_level_alloc.h index f3e8aa57f94f..3c15605bed35 100644 --- a/absl/base/internal/low_level_alloc.h +++ b/absl/base/internal/low_level_alloc.h @@ -93,15 +93,12 @@ class LowLevelAlloc { // DefaultArena(). Not supported on all platforms. kAsyncSignalSafe = 0x0002, #endif - - // When used with DefaultArena(), the NewArena() and DeleteArena() calls - // obey the flags given explicitly in the NewArena() call, even if those - // flags differ from the settings in DefaultArena(). So the call - // NewArena(kAsyncSignalSafe, DefaultArena()) is itself async-signal-safe, - // as well as generatating an arena that provides async-signal-safe - // Alloc/Free. }; - static Arena *NewArena(int32_t flags, Arena *meta_data_arena); + // Construct a new arena. The allocation of the underlying metadata honors + // the provided flags. For example, the call NewArena(kAsyncSignalSafe) + // is itself async-signal-safe, as well as generatating an arena that provides + // async-signal-safe Alloc/Free. + static Arena *NewArena(int32_t flags); // Destroys an arena allocated by NewArena and returns true, // provided no allocated blocks remain in the arena. diff --git a/absl/base/internal/low_level_alloc_test.cc b/absl/base/internal/low_level_alloc_test.cc index 2935760dad53..7c359f306115 100644 --- a/absl/base/internal/low_level_alloc_test.cc +++ b/absl/base/internal/low_level_alloc_test.cc @@ -84,7 +84,7 @@ static void Test(bool use_new_arena, bool call_malloc_hook, int n) { LowLevelAlloc::Arena *arena = 0; if (use_new_arena) { int32_t flags = call_malloc_hook ? LowLevelAlloc::kCallMallocHook : 0; - arena = LowLevelAlloc::NewArena(flags, LowLevelAlloc::DefaultArena()); + arena = LowLevelAlloc::NewArena(flags); } for (int i = 0; i != n; i++) { if (i != 0 && i % 10000 == 0) { diff --git a/absl/base/internal/pretty_function.h b/absl/base/internal/pretty_function.h index 6be3936f7c24..01b0547bd08a 100644 --- a/absl/base/internal/pretty_function.h +++ b/absl/base/internal/pretty_function.h @@ -1,3 +1,17 @@ +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_ #define ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_ |