Export of internal Abseil changes.
-- 1a5fb4eb5bc6c0332962f659470a07908168aa5c by CJ Johnson <johnsoncj@google.com>: Move InlinedVector's AbslHashValue(...) definition to out of line PiperOrigin-RevId: 224389234 -- b7c5ccdfe17b9cb5f7124c8d591ce0989a15b9fb by Jon Cohen <cohenjon@google.com>: Add a shebang line and chmod +x generate_copts.py. Note that we use the "python" command as suggested in PEP 934 (https://www.python.org/dev/peps/pep-0394/) as this script should work in both Python 2 and Python 3. Also adds a gitignore for __pycache__ for when using python3 PiperOrigin-RevId: 224375405 -- c57a148a1106b21dbcd750541f10b058bf55a2bf by CJ Johnson <johnsoncj@google.com>: Adds comment to InlinedVector intended to help the g4 diffing algo to better identify the substantive change PiperOrigin-RevId: 224362807 -- b635ab981a07dc2434be7b0d164030a42cc67923 by Greg Falcon <gfalcon@google.com>: internal change PiperOrigin-RevId: 224362442 -- 217021f7dcec31141a89b91930c241af062c2133 by CJ Johnson <johnsoncj@google.com>: Distinguishes the source of InlinedVector::at(...)'s bounds checking exception PiperOrigin-RevId: 224341645 -- 01a5943560ce9216a9d8ccb1279b5c5c2f6e1019 by CJ Johnson <johnsoncj@google.com>: Relocates out of line member function definitions to their respective declarations in InlinedVector PiperOrigin-RevId: 224320130 -- b3d57fcddcd737e91aab812d69b82fef2ca43d7e by Abseil Team <absl-team@google.com>: On 32-bit systems, the alignment of int64 can be 4 bytes. Created a custom Int64 type (to go with the custom Int128 type) just for the purpose of testing layouts and alignments; it doesn't need to support actual arithmetic. PiperOrigin-RevId: 224209785 GitOrigin-RevId: 1a5fb4eb5bc6c0332962f659470a07908168aa5c Change-Id: I9d6b1c441cd712709ebd6c0a8911d0755cab506f
This commit is contained in:
		
							parent
							
								
									284378a71b
								
							
						
					
					
						commit
						f197d7c72a
					
				
					 8 changed files with 443 additions and 516 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -10,5 +10,6 @@ build | |||
| CMakeLists.txt.user | ||||
| # Ignore VS Code files | ||||
| .vscode/* | ||||
| # Ignore generated .pyc binaries | ||||
| # Ignore generated python artifacts | ||||
| copts/copts.pyc | ||||
| copts/__pycache__/ | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ | |||
| #include <vector> | ||||
| 
 | ||||
| #include "gtest/gtest.h" | ||||
| #include "absl/base/attributes.h" | ||||
| #include "absl/base/thread_annotations.h" | ||||
| #include "absl/synchronization/mutex.h" | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -45,7 +45,7 @@ Expected Type(Actual val) { | |||
|   return val; | ||||
| } | ||||
| 
 | ||||
| // Helper class to test different size and alignments.
 | ||||
| // Helper classes to test different size and alignments.
 | ||||
| struct alignas(8) Int128 { | ||||
|   uint64_t a, b; | ||||
|   friend bool operator==(Int128 lhs, Int128 rhs) { | ||||
|  | @ -57,6 +57,14 @@ struct alignas(8) Int128 { | |||
|   } | ||||
| }; | ||||
| 
 | ||||
| // int64_t is *not* 8-byte aligned on all platforms!
 | ||||
| struct alignas(8) Int64 { | ||||
|   int64_t a; | ||||
|   friend bool operator==(Int64 lhs, Int64 rhs) { | ||||
|     return lhs.a == rhs.a; | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
| // Properties of types that this test relies on.
 | ||||
| static_assert(sizeof(int8_t) == 1, ""); | ||||
| static_assert(alignof(int8_t) == 1, ""); | ||||
|  | @ -64,6 +72,8 @@ static_assert(sizeof(int16_t) == 2, ""); | |||
| static_assert(alignof(int16_t) == 2, ""); | ||||
| static_assert(sizeof(int32_t) == 4, ""); | ||||
| static_assert(alignof(int32_t) == 4, ""); | ||||
| static_assert(sizeof(Int64) == 8, ""); | ||||
| static_assert(alignof(Int64) == 8, ""); | ||||
| static_assert(sizeof(Int128) == 16, ""); | ||||
| static_assert(alignof(Int128) == 8, ""); | ||||
| 
 | ||||
|  | @ -1281,14 +1291,14 @@ TEST(Layout, OverAligned) { | |||
| TEST(Layout, Alignment) { | ||||
|   static_assert(Layout<int8_t>::Alignment() == 1, ""); | ||||
|   static_assert(Layout<int32_t>::Alignment() == 4, ""); | ||||
|   static_assert(Layout<int64_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<Int64>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<Aligned<int8_t, 64>>::Alignment() == 64, ""); | ||||
|   static_assert(Layout<int8_t, int32_t, int64_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int8_t, int64_t, int32_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int32_t, int8_t, int64_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int32_t, int64_t, int8_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int64_t, int8_t, int32_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int64_t, int32_t, int8_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int8_t, int32_t, Int64>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int8_t, Int64, int32_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int32_t, int8_t, Int64>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<int32_t, Int64, int8_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<Int64, int8_t, int32_t>::Alignment() == 8, ""); | ||||
|   static_assert(Layout<Int64, int32_t, int8_t>::Alignment() == 8, ""); | ||||
| } | ||||
| 
 | ||||
| TEST(Layout, ConstexprPartial) { | ||||
|  | @ -1323,7 +1333,7 @@ void ExpectPoisoned(const unsigned char (&buf)[N], | |||
| } | ||||
| 
 | ||||
| TEST(Layout, PoisonPadding) { | ||||
|   using L = Layout<int8_t, int64_t, int32_t, Int128>; | ||||
|   using L = Layout<int8_t, Int64, int32_t, Int128>; | ||||
| 
 | ||||
|   constexpr size_t n = L::Partial(1, 2, 3, 4).AllocSize(); | ||||
|   { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| # GENERATED! DO NOT MANUALLY EDIT THIS FILE. | ||||
| # | ||||
| # (1) Edit absl/copts/copts.py. | ||||
| # (2) Run `python <path_to_absl>/copts/generate_copts.py`. | ||||
| # (2) Run `<path_to_absl>/copts/generate_copts.py`. | ||||
| 
 | ||||
| list(APPEND GCC_EXCEPTIONS_FLAGS | ||||
|     "-fexceptions" | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| """GENERATED! DO NOT MANUALLY EDIT THIS FILE. | ||||
| 
 | ||||
| (1) Edit absl/copts/copts.py. | ||||
| (2) Run `python <path_to_absl>/copts/generate_copts.py`. | ||||
| (2) Run `<path_to_absl>/copts/generate_copts.py`. | ||||
| """ | ||||
| 
 | ||||
| GCC_EXCEPTIONS_FLAGS = [ | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ This is the source of truth for Abseil compiler options.  To modify Abseil | |||
| compilation options: | ||||
| 
 | ||||
|   (1) Edit the appropriate list in this file. | ||||
|   (2) Run `python <path_to_absl>/copts/generate_copts.py`. | ||||
|   (2) Run `<path_to_absl>/copts/generate_copts.py`. | ||||
| 
 | ||||
| The generated copts are consumed by configure_copts.bzl and | ||||
| AbseilConfigureCopts.cmake. | ||||
|  |  | |||
							
								
								
									
										3
									
								
								absl/copts/generate_copts.py
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										3
									
								
								absl/copts/generate_copts.py
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -1,6 +1,7 @@ | |||
| #!/usr/bin/python | ||||
| """Generate Abseil compile compile option configs. | ||||
| 
 | ||||
| Usage: python absl/generate_copts.py | ||||
| Usage: <path_to_absl>/copts/generate_copts.py | ||||
| 
 | ||||
| The configs are generated from copts.py. | ||||
| """ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue