Googletest export
Let embedders customize GTEST_INTERNAL_DEPRECATED(). GTEST_INTERNAL_DEPRECATED is currently used to nudge googletest users to migrate off old TEST_CASE macros to the new TEST_SUITE macros. This move is non-trivial for Chromium (see https://crbug.com/925652), and might be difficult for other big projects with many dependencies. This CL facilitates moving off of deprecated APIs by making it possible for an embedder to define GTEST_INTERNAL_DEPRECATED() in gtest/internal/custom/gtest-port.h. Example usage: 1) #define GTEST_INTERNAL_DEPRECATED() to nothing, to disable deprecation warnings while migrating off googletest's deprecated APIs. This can be preferable to having to disable all deprecation warnings (-Wno-error=deprecated or -Wno-deprecated-declarations). 2) #define GTEST_INTERNAL_DEPRECATED() for an unsupported compiler. PiperOrigin-RevId: 236171043
This commit is contained in:
		
				
					committed by
					
						
						Gennadiy Civil
					
				
			
			
				
	
			
			
			
						parent
						
							56ef07a203
						
					
				
				
					commit
					db9b85e275
				
			@@ -1283,7 +1283,7 @@ class FlatTuple
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Utility functions to be called with static_assert to induce deprecation
 | 
					// Utility functions to be called with static_assert to induce deprecation
 | 
				
			||||||
// warinings
 | 
					// warnings.
 | 
				
			||||||
GTEST_INTERNAL_DEPRECATED(
 | 
					GTEST_INTERNAL_DEPRECATED(
 | 
				
			||||||
    "INSTANTIATE_TEST_CASE_P is deprecated, please use "
 | 
					    "INSTANTIATE_TEST_CASE_P is deprecated, please use "
 | 
				
			||||||
    "INSTANTIATE_TEST_SUITE_P")
 | 
					    "INSTANTIATE_TEST_SUITE_P")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -245,6 +245,11 @@
 | 
				
			|||||||
//   BoolFromGTestEnv()   - parses a bool environment variable.
 | 
					//   BoolFromGTestEnv()   - parses a bool environment variable.
 | 
				
			||||||
//   Int32FromGTestEnv()  - parses an Int32 environment variable.
 | 
					//   Int32FromGTestEnv()  - parses an Int32 environment variable.
 | 
				
			||||||
//   StringFromGTestEnv() - parses a string environment variable.
 | 
					//   StringFromGTestEnv() - parses a string environment variable.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Deprecation warnings:
 | 
				
			||||||
 | 
					//   GTEST_INTERNAL_DEPRECATED(message) - attribute marking a function as
 | 
				
			||||||
 | 
					//                                        deprecated; calling a marked function
 | 
				
			||||||
 | 
					//                                        should generate a compiler warning
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <ctype.h>   // for isspace, etc
 | 
					#include <ctype.h>   // for isspace, etc
 | 
				
			||||||
#include <stddef.h>  // for ptrdiff_t
 | 
					#include <stddef.h>  // for ptrdiff_t
 | 
				
			||||||
@@ -2301,6 +2306,8 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
 | 
				
			|||||||
}  // namespace internal
 | 
					}  // namespace internal
 | 
				
			||||||
}  // namespace testing
 | 
					}  // namespace testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !defined(GTEST_INTERNAL_DEPRECATED)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Internal Macro to mark an API deprecated, for googletest usage only
 | 
					// Internal Macro to mark an API deprecated, for googletest usage only
 | 
				
			||||||
// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
 | 
					// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
 | 
				
			||||||
// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
 | 
					// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
 | 
				
			||||||
@@ -2317,4 +2324,6 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
 | 
				
			|||||||
#define GTEST_INTERNAL_DEPRECATED(message)
 | 
					#define GTEST_INTERNAL_DEPRECATED(message)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // !defined(GTEST_INTERNAL_DEPRECATED)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
 | 
					#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user