The prompt parameter to getpass() is declared as nonnull (using a GCC nonnull attribute), but the implementation checks whether it is null in two places. GCC warns about this. This commit removes the checks, which don't appear in the Gnulib POSIX implementation or the glibc implementation. --- I haven't pushed this yet; I'm posting it for review.
2020-09-12 Ben Pfaff <b...@cs.stanford.edu> Remove null checks for parameter declared as nonnull. * lib/getpass.c (getpass) [_WIN32]: Don't check whether 'prompt' argument is nonnull. diff --git a/lib/getpass.c b/lib/getpass.c index 3b0552ec58..f256bacdd8 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -194,11 +194,8 @@ getpass (const char *prompt) size_t i = 0; int c; - if (prompt) - { - fputs (prompt, stderr); - fflush (stderr); - } + fputs (prompt, stderr); + fflush (stderr); for (;;) { @@ -220,11 +217,8 @@ getpass (const char *prompt) } } - if (prompt) - { - fputs ("\r\n", stderr); - fflush (stderr); - } + fputs ("\r\n", stderr); + fflush (stderr); return strdup (getpassbuf); } -- 2.28.0