getopt: Fix conversion from string-literal to non-const char *
Define a non-const static char EMSG[] = "" to avoid having to add __DECONST() to all uses of EMSG. Also make current_dash a const char * to fix this warning.
This commit is contained in:
parent
74eb7f97ec
commit
0348c8fcfa
@ -54,8 +54,7 @@ char *optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
static char EMSG[] = "";
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
|
@ -88,7 +88,7 @@ char *optarg; /* argument associated with option */
|
||||
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
|
||||
#define INORDER (int)1
|
||||
|
||||
#define EMSG ""
|
||||
static char EMSG[] = "";
|
||||
|
||||
#ifdef GNU_COMPATIBLE
|
||||
#define NO_PREFIX (-1)
|
||||
@ -194,7 +194,7 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
{
|
||||
char *current_argv, *has_equal;
|
||||
#ifdef GNU_COMPATIBLE
|
||||
char *current_dash;
|
||||
const char *current_dash;
|
||||
#endif
|
||||
size_t current_argv_len;
|
||||
int i, match, exact_match, second_partial_match;
|
||||
|
@ -41,6 +41,7 @@ CWARNFLAGS+= -Wno-typedef-redefinition
|
||||
# bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely
|
||||
# noisy when building on Linux.
|
||||
CWARNFLAGS+= -Wno-system-headers
|
||||
CWARNFLAGS.clang+=-Werror=incompatible-pointer-types-discards-qualifiers
|
||||
|
||||
# b64_pton and b64_ntop is in libresolv on MacOS and Linux:
|
||||
# TODO: only needed for uuencode and uudecode
|
||||
|
Loading…
Reference in New Issue
Block a user