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
{
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."),
argv[0],
PACKAGE_BUGREPORT);
_(L"%ls: Missing function definition information."),
argv[0] );
bugreport();
}
}
@ -2633,7 +2633,6 @@ static int builtin_end( wchar_t **argv )
parser_pop_block();
}
/*
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;
}
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 ) \
if( !(arg) ) \
{ \
debug( 1, \
_( 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." ), \
debug( 0, \
_( L"function %s called with null value for argument %s. " ), \
__func__, \
#arg, \
PACKAGE_BUGREPORT ); \
#arg ); \
bugreport(); \
return retval; \
}
@ -113,16 +111,14 @@ extern wchar_t *program_name;
Check if signals are blocked. If so, print an error message and
return from the function performing this check.
*/
#define CHECK_BLOCK( retval ) \
#define CHECK_BLOCK( retval ) \
if( signal_is_blocked() ) \
{ \
debug( 0, \
L"function %s called while blocking signals. " \
L"This is a bug. " \
L"If you can reproduce it, please send a bug report to %s.", \
__func__, \
PACKAGE_BUGREPORT ); \
return retval; \
_( L"function %s called while blocking signals. " ), \
__func__); \
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 );
/**
Print a short message about how to file a bug report to stderr
*/
void bugreport();
#endif

View File

@ -56,12 +56,6 @@ The fish parser. Contains functions for parsing code.
*/
#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
*/
@ -474,11 +468,9 @@ void parser_pop_block()
if( !current_block )
{
debug( 1,
L"function %s called on empty block stack. "
L"This is a bug. "
L"If you can reproduce it, please send a bug report to %s.",
__func__,
PACKAGE_BUGREPORT ); \
L"function %s called on empty block stack.",
__func__);
bugreport();
return;
}
@ -2521,9 +2513,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
{
debug( 1,
EVAL_NULL_ERR_MSG );
debug( 1,
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
bugreport();
return 1;
}
@ -2533,10 +2523,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
debug( 1,
INVALID_SCOPE_ERR_MSG,
parser_get_block_desc( block_type ) );
debug( 1,
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
bugreport();
return 1;
}
@ -2570,9 +2557,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
{
debug( 0,
_(L"End of block mismatch. Program terminating.") );
debug( 0,
BUGREPORT_MSG,
PACKAGE_BUGREPORT );
bugreport();
exit(1);
break;
}