mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Add compiler warnings for some common incorrect usage of functions, such as forgetting to cast null pointers to variadic functions
darcs-hash:20061019151947-ac50b-4043638a7a830fa80fd918f92365f5afe3ff208a.gz
This commit is contained in:
parent
ea998b03f2
commit
2d05b1c1b4
6 changed files with 18 additions and 8 deletions
5
common.h
5
common.h
|
@ -106,6 +106,7 @@ extern wchar_t *program_name;
|
||||||
*/
|
*/
|
||||||
#define N_(wstr) wstr
|
#define N_(wstr) wstr
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Take an array_list_t containing wide strings and converts them to a
|
Take an array_list_t containing wide strings and converts them to a
|
||||||
single null-terminated wchar_t **. The array is allocated using
|
single null-terminated wchar_t **. The array is allocated using
|
||||||
|
@ -193,7 +194,7 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
|
||||||
Returns a newly allocated concatenation of the specified wide
|
Returns a newly allocated concatenation of the specified wide
|
||||||
character strings. The last argument must be a null pointer.
|
character strings. The last argument must be a null pointer.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
__sentinel wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test if the given string is a valid variable name
|
Test if the given string is a valid variable name
|
||||||
|
@ -256,7 +257,7 @@ const wchar_t *wsetlocale( int category, const wchar_t *locale );
|
||||||
|
|
||||||
\return zero is needle is not found, of if needle is null, non-zero otherwise
|
\return zero is needle is not found, of if needle is null, non-zero otherwise
|
||||||
*/
|
*/
|
||||||
int contains_str( const wchar_t *needle, ... );
|
__sentinel int contains_str( const wchar_t *needle, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call read while blocking the SIGCHLD signal. Should only be called
|
Call read while blocking the SIGCHLD signal. Should only be called
|
||||||
|
|
|
@ -92,6 +92,15 @@ AC_SUBST( optbindirs, $optbindirs )
|
||||||
# Tell autoconf to create config.h header
|
# Tell autoconf to create config.h header
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
|
|
||||||
|
AH_BOTTOM([#if __GNUC__ >= 3
|
||||||
|
#define __warn_unused __attribute__ ((warn_unused_result))
|
||||||
|
#define __sentinel __attribute__ ((sentinel))
|
||||||
|
#else
|
||||||
|
#define __warn_unused
|
||||||
|
#define __sentinel
|
||||||
|
#endif])
|
||||||
|
|
||||||
|
|
||||||
# Set up various programs needed for install
|
# Set up various programs needed for install
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
|
|
4
env.h
4
env.h
|
@ -80,8 +80,8 @@ void env_destroy();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int env_set( const wchar_t *key,
|
int env_set( const wchar_t *key,
|
||||||
const wchar_t *val,
|
const wchar_t *val,
|
||||||
int mode );
|
int mode );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
4
exec.h
4
exec.h
|
@ -51,8 +51,8 @@ void exec( job_t *j );
|
||||||
|
|
||||||
\return the status of the last job to exit, or -1 if en error was encountered.
|
\return the status of the last job to exit, or -1 if en error was encountered.
|
||||||
*/
|
*/
|
||||||
int exec_subshell( const wchar_t *cmd,
|
__warn_unused int exec_subshell( const wchar_t *cmd,
|
||||||
array_list_t *l );
|
array_list_t *l );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
2
expand.h
2
expand.h
|
@ -139,7 +139,7 @@ enum
|
||||||
\param out The list to which the result will be appended.
|
\param out The list to which the result will be appended.
|
||||||
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH. EXPAND_WILDCARD_NO_MATCH and EXPAND_WILDCARD_MATCH are normal exit conditions used only on strings containing wildcards to tell if the wildcard produced any matches.
|
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH. EXPAND_WILDCARD_NO_MATCH and EXPAND_WILDCARD_MATCH are normal exit conditions used only on strings containing wildcards to tell if the wildcard produced any matches.
|
||||||
*/
|
*/
|
||||||
int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
__warn_unused int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
expand_one is identical to expand_string, except it will fail if in
|
expand_one is identical to expand_string, except it will fail if in
|
||||||
|
|
2
util.h
2
util.h
|
@ -607,7 +607,7 @@ void sb_append_char( string_buffer_t *, wchar_t );
|
||||||
|
|
||||||
Do not forget to cast the last 0 to (void *), or you might encounter errors on 64-bit platforms!
|
Do not forget to cast the last 0 to (void *), or you might encounter errors on 64-bit platforms!
|
||||||
*/
|
*/
|
||||||
void sb_append2( string_buffer_t *, ... );
|
__sentinel void sb_append2( string_buffer_t *, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append formated string data to the buffer. This function internally
|
Append formated string data to the buffer. This function internally
|
||||||
|
|
Loading…
Reference in a new issue