mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			formatter.h (_Error_formatter::_M_function): New.
2018-05-08 François Dumont <fdumont@gcc.gnu.org> * include/debug/formatter.h (_Error_formatter::_M_function): New. (_Error_formatter(const char*, unsigned int)): Adapt. (_Error_formatter::_M_at): Rename in... (_Error_formatter::_S_at): ...that and adapt. * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): New. (_GLIBCXX_DEBUG_VERIFY_AT, _GLIBCXX_DEBUG_VERIFY): Adapt. * src/c++11/debug.cc (_Error_formatter::_M_error): Render _M_function when available. From-SVN: r260052
This commit is contained in:
		
							parent
							
								
									9f171abdbc
								
							
						
					
					
						commit
						a5277405c8
					
				|  | @ -1,3 +1,14 @@ | |||
| 2018-05-08  François Dumont  <fdumont@gcc.gnu.org> | ||||
| 
 | ||||
| 	* include/debug/formatter.h (_Error_formatter::_M_function): New. | ||||
| 	(_Error_formatter(const char*, unsigned int)): Adapt. | ||||
| 	(_Error_formatter::_M_at): Rename in... | ||||
| 	(_Error_formatter::_S_at): ...that and adapt. | ||||
| 	* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): New. | ||||
| 	(_GLIBCXX_DEBUG_VERIFY_AT, _GLIBCXX_DEBUG_VERIFY): Adapt. | ||||
| 	* src/c++11/debug.cc (_Error_formatter::_M_error): Render _M_function | ||||
| 	when available. | ||||
| 
 | ||||
| 2018-05-08  Jonathan Wakely  <jwakely@redhat.com> | ||||
| 
 | ||||
| 	* include/bits/regex_automaton.h (_NFA_base::_M_paren_stack, _NFA): | ||||
|  |  | |||
|  | @ -467,8 +467,10 @@ namespace __gnu_debug | |||
| #endif | ||||
| 
 | ||||
|   private: | ||||
|     _Error_formatter(const char* __file, unsigned int __line) | ||||
|     _Error_formatter(const char* __file, unsigned int __line, | ||||
| 		     const char* __function) | ||||
|     : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0) | ||||
|     , _M_function(__function) | ||||
|     { } | ||||
| 
 | ||||
| #if !_GLIBCXX_INLINE_VERSION | ||||
|  | @ -483,12 +485,13 @@ namespace __gnu_debug | |||
|     _Parameter		_M_parameters[__max_parameters]; | ||||
|     unsigned int	_M_num_parameters; | ||||
|     const char*		_M_text; | ||||
|     const char*		_M_function; | ||||
| 
 | ||||
|   public: | ||||
|     static _Error_formatter& | ||||
|     _M_at(const char* __file, unsigned int __line) | ||||
|     _S_at(const char* __file, unsigned int __line, const char* __function) | ||||
|     { | ||||
|       static _Error_formatter __formatter(__file, __line); | ||||
|       static _Error_formatter __formatter(__file, __line, __function); | ||||
|       return __formatter; | ||||
|     } | ||||
|   }; | ||||
|  |  | |||
|  | @ -38,16 +38,20 @@ | |||
|  * the user error and where the error is reported. | ||||
|  * | ||||
|  */ | ||||
| #define _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,_File,_Line)	\ | ||||
| #define _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,_Func)	\ | ||||
|   do									\ | ||||
|   {									\ | ||||
|     if (! (_Condition))							\ | ||||
|       __gnu_debug::_Error_formatter::_M_at(_File, _Line)		\ | ||||
| 	  ._ErrorMessage._M_error();					\ | ||||
|     if (! (_Cond))							\ | ||||
|       __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func)		\ | ||||
| 	._ErrMsg._M_error();						\ | ||||
|   } while (false) | ||||
| 
 | ||||
| #define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage)			\ | ||||
|   _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,__FILE__,__LINE__) | ||||
| #define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line)		\ | ||||
|   _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,__PRETTY_FUNCTION__) | ||||
| 
 | ||||
| #define _GLIBCXX_DEBUG_VERIFY(_Cond,_ErrMsg)				\ | ||||
|   _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond, _ErrMsg, __FILE__, __LINE__,	\ | ||||
| 			     __PRETTY_FUNCTION__) | ||||
| 
 | ||||
| // Verify that [_First, _Last) forms a valid iterator range.
 | ||||
| #define __glibcxx_check_valid_range(_First,_Last)			\ | ||||
|  |  | |||
|  | @ -923,9 +923,9 @@ namespace | |||
| 	    continue; | ||||
| 	  } | ||||
| 
 | ||||
| 	if (*start != '%') | ||||
| 	if (!num_parameters || *start != '%') | ||||
| 	  { | ||||
| 	    // Normal char.
 | ||||
| 	    // Normal char or no parameter to look for.
 | ||||
| 	    buf[bufindex++] = *start++; | ||||
| 	    continue; | ||||
| 	  } | ||||
|  | @ -1034,6 +1034,15 @@ namespace __gnu_debug | |||
|     if (ctx._M_max_length) | ||||
|       ctx._M_wordwrap = true; | ||||
| 
 | ||||
|     if (_M_function) | ||||
|       { | ||||
| 	print_literal(ctx, "In function:\n"); | ||||
| 	print_string(ctx, _M_function, nullptr, 0); | ||||
| 	print_literal(ctx, "\n"); | ||||
| 	ctx._M_first_line = true; | ||||
| 	print_literal(ctx, "\n"); | ||||
|       } | ||||
| 
 | ||||
|     print_literal(ctx, "Error: "); | ||||
| 
 | ||||
|     // Print the error message
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 François Dumont
						François Dumont