linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kunit: fix -Wunused-function warning for __kunit_fail_current_test
@ 2021-04-06 17:29 Daniel Latypov
  2021-04-06 20:50 ` Brendan Higgins
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Latypov @ 2021-04-06 17:29 UTC (permalink / raw)
  To: brendanhiggins
  Cc: davidgow, linux-kernel, kunit-dev, linux-kselftest, skhan, sfr,
	Daniel Latypov

When CONFIG_KUNIT is not enabled, __kunit_fail_current_test() an empty
static function.

But GCC complains about unused static functions, *unless* they're static inline.
So add inline to make GCC happy.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Fixes: 359a376081d4 ("kunit: support failure from dynamic analysis tools")
---
 include/kunit/test-bug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/kunit/test-bug.h b/include/kunit/test-bug.h
index ce6f6edc7801..5fc58081d511 100644
--- a/include/kunit/test-bug.h
+++ b/include/kunit/test-bug.h
@@ -19,8 +19,8 @@ extern __printf(3, 4) void __kunit_fail_current_test(const char *file, int line,
 
 #else
 
-static __printf(3, 4) void __kunit_fail_current_test(const char *file, int line,
-						    const char *fmt, ...)
+static inline __printf(3, 4) void __kunit_fail_current_test(const char *file, int line,
+							    const char *fmt, ...)
 {
 }
 

base-commit: 359a376081d4fadfb073e3ddeb6bd6dc94d98341
-- 
2.31.0.208.g409f899ff0-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: fix -Wunused-function warning for __kunit_fail_current_test
  2021-04-06 17:29 [PATCH] kunit: fix -Wunused-function warning for __kunit_fail_current_test Daniel Latypov
@ 2021-04-06 20:50 ` Brendan Higgins
  2021-04-06 21:19   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Brendan Higgins @ 2021-04-06 20:50 UTC (permalink / raw)
  To: Daniel Latypov
  Cc: David Gow, Linux Kernel Mailing List, KUnit Development,
	open list:KERNEL SELFTEST FRAMEWORK, Shuah Khan,
	Stephen Rothwell

On Tue, Apr 6, 2021 at 10:29 AM Daniel Latypov <dlatypov@google.com> wrote:
>
> When CONFIG_KUNIT is not enabled, __kunit_fail_current_test() an empty
> static function.
>
> But GCC complains about unused static functions, *unless* they're static inline.
> So add inline to make GCC happy.
>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> Fixes: 359a376081d4 ("kunit: support failure from dynamic analysis tools")

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: fix -Wunused-function warning for __kunit_fail_current_test
  2021-04-06 20:50 ` Brendan Higgins
@ 2021-04-06 21:19   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-04-06 21:19 UTC (permalink / raw)
  To: Brendan Higgins, Daniel Latypov
  Cc: David Gow, Linux Kernel Mailing List, KUnit Development,
	open list:KERNEL SELFTEST FRAMEWORK, Stephen Rothwell,
	Shuah Khan

On 4/6/21 2:50 PM, Brendan Higgins wrote:
> On Tue, Apr 6, 2021 at 10:29 AM Daniel Latypov <dlatypov@google.com> wrote:
>>
>> When CONFIG_KUNIT is not enabled, __kunit_fail_current_test() an empty
>> static function.
>>
>> But GCC complains about unused static functions, *unless* they're static inline.
>> So add inline to make GCC happy.
>>
>> Signed-off-by: Daniel Latypov <dlatypov@google.com>
>> Fixes: 359a376081d4 ("kunit: support failure from dynamic analysis tools")
> 

Signed-off-by comes after Fixes. Also good to add Reported-by for 
Stephen acknowledging the reporter.

I will fix this up when I apply - for future reference.

> Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> 

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-06 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 17:29 [PATCH] kunit: fix -Wunused-function warning for __kunit_fail_current_test Daniel Latypov
2021-04-06 20:50 ` Brendan Higgins
2021-04-06 21:19   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).