silence some -Wuninitialized false positives
There are a few error functions that simply wrap error() and provide a standardized message text. Like error(), they always return -1; knowing that can help the compiler silence some false positive -Wuninitialized warnings. One strategy would be to just declare these as inline in the header file so that the compiler can see that they always return -1. However, gcc does not always inline them (e.g., it will not inline opterror, even with -O3), which renders our change pointless. Instead, let's follow the same route we did with error() in the last patch, and define a macro that makes the constant return value obvious to the compiler. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e208f9cc75
commit
a469a10193
3
cache.h
3
cache.h
@ -1136,6 +1136,9 @@ extern int check_repository_format_version(const char *var, const char *value, v
|
||||
extern int git_env_bool(const char *, int);
|
||||
extern int git_config_system(void);
|
||||
extern int config_error_nonbool(const char *);
|
||||
#ifdef __GNUC__
|
||||
#define config_error_nonbool(s) (config_error_nonbool(s), -1)
|
||||
#endif
|
||||
extern const char *get_log_output_encoding(void);
|
||||
extern const char *get_commit_output_encoding(void);
|
||||
|
||||
|
Reference in New Issue
Block a user