From patchwork Wed May 24 15:50:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Shankar X-Patchwork-Id: 20563 Received: (qmail 129418 invoked by alias); 24 May 2017 15:50:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 129398 invoked by uid 89); 24 May 2017 15:50:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=UD:se, H*F:D*se X-HELO: aloka.lostca.se Date: Wed, 24 May 2017 15:50:00 +0000 From: Arjun Shankar To: libc-alpha@sourceware.org Subject: [PATCH] Use an alias to `ptsname_r' in login/tst-ptsname.c Message-ID: <20170524155000.GA45792@aloka.lostca.se> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) When compiled with `-O3', inlining causes GCC to realize that one of the tests calls `ptsname_r' with a NULL buffer and error out when compiling with -Wnonnull. Declare `ptsname_r_alias' and alias it to `ptsname_r' to avoid this. ChangeLog: 2017-05-24 Arjun Shankar * login/tst-ptsname.c (ptsname_r_alias): New declaration. (do_single_test): Use ptsname_r_alias instead of ptsname_r. --- login/tst-ptsname.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/login/tst-ptsname.c b/login/tst-ptsname.c index be8744d..dbc8d19 100644 --- a/login/tst-ptsname.c +++ b/login/tst-ptsname.c @@ -27,11 +27,16 @@ #define DEV_TTY "/dev/tty" #define PTSNAME_EINVAL "./ptsname-einval" +/* When compiled with `-O3', inlining causes GCC to realize that one of the + tests calls `ptsname_r' with a NULL buffer and error out when compiling + with -Wnonnull. To avoid this, we use an alias instead. */ +int ptsname_r_alias (int, char *, size_t) __asm__ ("ptsname_r"); + static int do_single_test (int fd, char *buf, size_t buflen, int expected_err) { - int ret = ptsname_r (fd, buf, buflen); + int ret = ptsname_r_alias (fd, buf, buflen); int err = errno; if (expected_err == 0)