Add a bugreport function for writing out a message about how to file bug reports

darcs-hash:20061117145825-ac50b-0480300cce24657aae9572b79f145d956db93593.gz
This commit is contained in:
axel 2006-11-18 00:58:25 +10:00
parent 4c1d1bb218
commit 54244fd33d
4 changed files with 31 additions and 38 deletions

View file

@ -2619,9 +2619,9 @@ static int builtin_end( wchar_t **argv )
else else
{ {
debug(0, debug(0,
_(L"%ls: Missing function definition information. This is a fish bug. If you can reproduce it, please file a bug report to %s."), _(L"%ls: Missing function definition information."),
argv[0], argv[0] );
PACKAGE_BUGREPORT); bugreport();
} }
} }
@ -2633,7 +2633,6 @@ static int builtin_end( wchar_t **argv )
parser_pop_block(); parser_pop_block();
} }
/* /*
If everything goes ok, return status of last command to execute. If everything goes ok, return status of last command to execute.
*/ */

View file

@ -1601,3 +1601,11 @@ int create_directory( wchar_t *d )
return ok?0:-1; return ok?0:-1;
} }
void bugreport()
{
debug( 1,
_( L"This is a bug. "
L"If you can reproduce it, please send a bug report to %s." ),
PACKAGE_BUGREPORT );
}

View file

@ -77,13 +77,11 @@ extern wchar_t *program_name;
#define CHECK( arg, retval ) \ #define CHECK( arg, retval ) \
if( !(arg) ) \ if( !(arg) ) \
{ \ { \
debug( 1, \ debug( 0, \
_( L"function %s called with null value for argument %s. " \ _( L"function %s called with null value for argument %s. " ), \
L"This is a bug. " \
L"If you can reproduce it, please send a bug report to %s." ), \
__func__, \ __func__, \
#arg, \ #arg ); \
PACKAGE_BUGREPORT ); \ bugreport(); \
return retval; \ return retval; \
} }
@ -113,16 +111,14 @@ extern wchar_t *program_name;
Check if signals are blocked. If so, print an error message and Check if signals are blocked. If so, print an error message and
return from the function performing this check. return from the function performing this check.
*/ */
#define CHECK_BLOCK( retval ) \ #define CHECK_BLOCK( retval ) \
if( signal_is_blocked() ) \ if( signal_is_blocked() ) \
{ \ { \
debug( 0, \ debug( 0, \
L"function %s called while blocking signals. " \ _( L"function %s called while blocking signals. " ), \
L"This is a bug. " \ __func__); \
L"If you can reproduce it, please send a bug report to %s.", \ bugreport(); \
__func__, \ return retval; \
PACKAGE_BUGREPORT ); \
return retval; \
} }
/** /**
@ -405,5 +401,10 @@ void tokenize_variable_array( const wchar_t *val, array_list_t *out );
*/ */
int create_directory( wchar_t *d ); int create_directory( wchar_t *d );
/**
Print a short message about how to file a bug report to stderr
*/
void bugreport();
#endif #endif

View file

@ -56,12 +56,6 @@ The fish parser. Contains functions for parsing code.
*/ */
#define MAX_RECURSION_DEPTH 128 #define MAX_RECURSION_DEPTH 128
/**
Message about reporting bugs, used on weird internal error to
hopefully get them to report stuff.
*/
#define BUGREPORT_MSG _( L"If this error can be reproduced, please send a bug report to %s.")
/** /**
Error message for improper use of the exec builtin Error message for improper use of the exec builtin
*/ */
@ -474,11 +468,9 @@ void parser_pop_block()
if( !current_block ) if( !current_block )
{ {
debug( 1, debug( 1,
L"function %s called on empty block stack. " L"function %s called on empty block stack.",
L"This is a bug. " __func__);
L"If you can reproduce it, please send a bug report to %s.", bugreport();
__func__,
PACKAGE_BUGREPORT ); \
return; return;
} }
@ -2521,9 +2513,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
{ {
debug( 1, debug( 1,
EVAL_NULL_ERR_MSG ); EVAL_NULL_ERR_MSG );
debug( 1, bugreport();
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
return 1; return 1;
} }
@ -2533,10 +2523,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
debug( 1, debug( 1,
INVALID_SCOPE_ERR_MSG, INVALID_SCOPE_ERR_MSG,
parser_get_block_desc( block_type ) ); parser_get_block_desc( block_type ) );
bugreport();
debug( 1,
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
return 1; return 1;
} }
@ -2570,9 +2557,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
{ {
debug( 0, debug( 0,
_(L"End of block mismatch. Program terminating.") ); _(L"End of block mismatch. Program terminating.") );
debug( 0, bugreport();
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
exit(1); exit(1);
break; break;
} }