From nobody Fri Apr 01 01:20:21 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE7651A59D9C; Fri, 1 Apr 2022 01:20:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KV2RJ64zTz3tQt; Fri, 1 Apr 2022 01:20:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 2311KLGe036218 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 1 Apr 2022 04:20:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 2311KLGe036218 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 2311KLW6036217; Fri, 1 Apr 2022 04:20:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 1 Apr 2022 04:20:21 +0300 From: Konstantin Belousov To: Ed Maste Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ef135466f81b - main - Clean up warnings in pthread tests Message-ID: References: <202202162130.21GLUiIc041139@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202202162130.21GLUiIc041139@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4KV2RJ64zTz3tQt X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.50 / 15.00]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.53)[0.526]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.98)[0.976]; MLMMJ_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-ThisMailContainsUnwantedMimeParts: N On Wed, Feb 16, 2022 at 09:30:44PM +0000, Ed Maste wrote: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ef135466f81bc3f203efa77d1eb81132f7646196 > > commit ef135466f81bc3f203efa77d1eb81132f7646196 > Author: Ed Maste > AuthorDate: 2022-02-16 21:10:45 +0000 > Commit: Ed Maste > CommitDate: 2022-02-16 21:28:31 +0000 > > Clean up warnings in pthread tests > > I intend to move these into lib/libthr/tests/ and connect to kyua. This > is a first step to address warnings emitted when building using standard > make infrastructure. > > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D34306 > --- > tools/regression/pthread/cv_cancel1/cv_cancel1.c | 14 +++++++------- > .../regression/pthread/mutex_isowned_np/mutex_isowned_np.c | 2 +- > tools/regression/pthread/unwind/Test.cpp | 6 +++--- > tools/regression/pthread/unwind/catch_pthread_exit.cpp | 6 +++--- > tools/regression/pthread/unwind/cond_wait_cancel.cpp | 8 ++++---- > tools/regression/pthread/unwind/cond_wait_cancel2.cpp | 12 ++++++------ > tools/regression/pthread/unwind/sem_wait_cancel.cpp | 6 +++--- > tools/regression/pthread/unwind/thread_normal_exit.cpp | 4 ++-- > 8 files changed, 29 insertions(+), 29 deletions(-) > > diff --git a/tools/regression/pthread/cv_cancel1/cv_cancel1.c b/tools/regression/pthread/cv_cancel1/cv_cancel1.c > index 2ae94c5a9f1c..140f55168dbb 100644 > --- a/tools/regression/pthread/cv_cancel1/cv_cancel1.c > +++ b/tools/regression/pthread/cv_cancel1/cv_cancel1.c > @@ -32,14 +32,14 @@ > > #define NLOOPS 10 > > -pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; > -pthread_cond_t cv = PTHREAD_COND_INITIALIZER; > +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; > +static pthread_cond_t cv = PTHREAD_COND_INITIALIZER; > > -int wake; > -int stop; > +static int wake; > +static int stop; > > -void * > -thr_routine(void *arg) > +static void * > +thr_routine(void *arg __unused) > { > pthread_mutex_lock(&m); > while (wake == 0) > @@ -51,7 +51,7 @@ thr_routine(void *arg) > return (NULL); > } > > -int main(int argc, char **argv) > +int main(int argc __unused, char **argv __unused) It is more idiomatic to change the prototype to int main(void) then, and more stylish to int main(void) > { > pthread_t td; > int i; > diff --git a/tools/regression/pthread/mutex_isowned_np/mutex_isowned_np.c b/tools/regression/pthread/mutex_isowned_np/mutex_isowned_np.c > index 5c23568c33ac..9eefef84ecf0 100644 > --- a/tools/regression/pthread/mutex_isowned_np/mutex_isowned_np.c > +++ b/tools/regression/pthread/mutex_isowned_np/mutex_isowned_np.c > @@ -46,7 +46,7 @@ thread(void *arg) > } > > int > -main(int argc, char *argv[]) > +main(int argc __unused, char *argv[] __unused) > { > pthread_t thr; > pthread_mutex_t mtx; > diff --git a/tools/regression/pthread/unwind/Test.cpp b/tools/regression/pthread/unwind/Test.cpp > index 9322deff621e..46e451c390b6 100644 > --- a/tools/regression/pthread/unwind/Test.cpp > +++ b/tools/regression/pthread/unwind/Test.cpp > @@ -1,7 +1,7 @@ > /* $FreeBSD$ */ > > -int destructed; > -int destructed2; > +static int destructed; > +static int destructed2; > > class Test { > public: > @@ -10,7 +10,7 @@ public: > }; > > void > -cleanup_handler(void *arg) > +cleanup_handler(void *arg __unused) > { > destructed2 = 1; > printf("%s()\n", __func__); > diff --git a/tools/regression/pthread/unwind/catch_pthread_exit.cpp b/tools/regression/pthread/unwind/catch_pthread_exit.cpp > index 15abc20d1fea..db0e875ccaeb 100644 > --- a/tools/regression/pthread/unwind/catch_pthread_exit.cpp > +++ b/tools/regression/pthread/unwind/catch_pthread_exit.cpp > @@ -5,10 +5,10 @@ > #include > #include > > -int caught; > +static int caught; > > -void * > -thr_routine(void *arg) > +static void * > +thr_routine(void *arg __unused) > { > try { > pthread_exit(NULL); > diff --git a/tools/regression/pthread/unwind/cond_wait_cancel.cpp b/tools/regression/pthread/unwind/cond_wait_cancel.cpp > index 5975e028a5ca..4dfa57746552 100644 > --- a/tools/regression/pthread/unwind/cond_wait_cancel.cpp > +++ b/tools/regression/pthread/unwind/cond_wait_cancel.cpp > @@ -8,11 +8,11 @@ > > #include "Test.cpp" > > -pthread_mutex_t mtx; > -pthread_cond_t cv; > +static pthread_mutex_t mtx; > +static pthread_cond_t cv; > > -void * > -thr(void *arg) > +static void * > +thr(void *arg __unused) > { > Test t; > > diff --git a/tools/regression/pthread/unwind/cond_wait_cancel2.cpp b/tools/regression/pthread/unwind/cond_wait_cancel2.cpp > index c781068918f1..ba71289fad98 100644 > --- a/tools/regression/pthread/unwind/cond_wait_cancel2.cpp > +++ b/tools/regression/pthread/unwind/cond_wait_cancel2.cpp > @@ -13,10 +13,10 @@ > > #include "Test.cpp" > > -pthread_mutex_t mtx; > -pthread_cond_t cv; > +static pthread_mutex_t mtx; > +static pthread_cond_t cv; > > -void f() > +static void f() > { > Test t; > > @@ -26,13 +26,13 @@ void f() > printf("Bug, thread shouldn't be here.\n"); > } > > -void g() > +static void g() > { > f(); > } > > -void * > -thr(void *arg) > +static void * > +thr(void *arg __unused) > { > pthread_cleanup_push(cleanup_handler, NULL); > g(); > diff --git a/tools/regression/pthread/unwind/sem_wait_cancel.cpp b/tools/regression/pthread/unwind/sem_wait_cancel.cpp > index 019164cb3166..2086de6037cb 100644 > --- a/tools/regression/pthread/unwind/sem_wait_cancel.cpp > +++ b/tools/regression/pthread/unwind/sem_wait_cancel.cpp > @@ -8,10 +8,10 @@ > > #include "Test.cpp" > > -sem_t sem; > +static sem_t sem; > > -void * > -thr(void *arg) > +static void * > +thr(void *arg __unused) > { > Test t; > > diff --git a/tools/regression/pthread/unwind/thread_normal_exit.cpp b/tools/regression/pthread/unwind/thread_normal_exit.cpp > index faf900e572c4..70768265be70 100644 > --- a/tools/regression/pthread/unwind/thread_normal_exit.cpp > +++ b/tools/regression/pthread/unwind/thread_normal_exit.cpp > @@ -7,8 +7,8 @@ > > #include "Test.cpp" > > -void * > -thr_routine(void *arg) > +static void * > +thr_routine(void *arg __unused) > { > Test test; >