From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 3729D3857815; Fri, 1 Jan 2021 01:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3729D3857815 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] declare getpass in analyzer/sensitive-1.c test X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 858954a2d4889b592440be3b68691be0ebec7bb5 X-Git-Newrev: a157d8c865f63d7b67b9dcc9a7ca72f06cc6ade1 Message-Id: <20210101013037.3729D3857815@sourceware.org> Date: Fri, 1 Jan 2021 01:30:37 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2021 01:30:37 -0000 https://gcc.gnu.org/g:a157d8c865f63d7b67b9dcc9a7ca72f06cc6ade1 commit a157d8c865f63d7b67b9dcc9a7ca72f06cc6ade1 Author: Alexandre Oliva Date: Thu Dec 31 21:38:17 2020 -0300 declare getpass in analyzer/sensitive-1.c test The getpass function is not available on all systems; and not necessarily declared in unistd.h, as expected by the sensitive-1 analyzer test. Since this is a compile-only test, it doesn't really matter if the function is defined in the system libraries. All we need is a declaration, to avoid warnings from calling an undeclared function. This patch adds the declaration, in a way that is most unlikely to conflict with any existing declaration. for gcc/testsuite/ChangeLog * gcc.dg/analyzer/sensitive-1.c: Declare getpass. Diff: --- gcc/testsuite/gcc.dg/analyzer/sensitive-1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/testsuite/gcc.dg/analyzer/sensitive-1.c b/gcc/testsuite/gcc.dg/analyzer/sensitive-1.c index 81144af620e..c66af927617 100644 --- a/gcc/testsuite/gcc.dg/analyzer/sensitive-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/sensitive-1.c @@ -6,6 +6,11 @@ #include +/* Declare getpass, in case unistd doesn't declare it. + Parenthesize it, in case it's a macro. + Don't use a prototype, to avoid const mismatches. */ +extern char *(getpass) (); + char test_1 (FILE *logfile) { char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */