All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN
@ 2023-03-09 10:33 Petr Vorel
  2023-03-09 10:44 ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-03-09 10:33 UTC (permalink / raw
  To: ltp

TST_NO_DEFAULT_MAIN must be defined before including tst_test.h.
Therefore test could have been compiled although there was no main() defined.

Fixes: 68fb61225 ("endian_switch01: rewrite to newlib")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/switch/endian_switch01.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/testcases/kernel/syscalls/switch/endian_switch01.c b/testcases/kernel/syscalls/switch/endian_switch01.c
index bee35184a..eae193fc1 100644
--- a/testcases/kernel/syscalls/switch/endian_switch01.c
+++ b/testcases/kernel/syscalls/switch/endian_switch01.c
@@ -24,8 +24,6 @@
 # define PPC_FEATURE_TRUE_LE              0x00000002
 # endif
 
-# define TST_NO_DEFAULT_MAIN
-
 /*
  * Make minimal call to 0x1ebe. If we get ENOSYS then syscall is not
  * available, likely because of:
-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN
  2023-03-09 10:33 [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN Petr Vorel
@ 2023-03-09 10:44 ` Petr Vorel
  2023-03-09 11:17   ` Jan Stancek
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-03-09 10:44 UTC (permalink / raw
  To: ltp

Hi Jan,

out of curiosity, what is main4() used for?

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN
  2023-03-09 10:44 ` Petr Vorel
@ 2023-03-09 11:17   ` Jan Stancek
  2023-03-09 12:09     ` Jan Stancek
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2023-03-09 11:17 UTC (permalink / raw
  To: Petr Vorel; +Cc: ltp

On Thu, Mar 9, 2023 at 11:44 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Jan,
>
> out of curiosity, what is main4() used for?

It's from 086c14f7a465 ("The following hack fixes the
"endian_switch01.c:115: warning: ‘main’ takes only zero or two
arguments" warning. Signed-off-by: CAI Qian <caiqian@cclom.cn>.")
but I'm not sure it is still used these days.

As you found my misplaced TST_NO_DEFAULT_MAIN, that seems to confirm
we can do without it. I'll have a look on a ppc system.

>
> Kind regards,
> Petr
>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN
  2023-03-09 11:17   ` Jan Stancek
@ 2023-03-09 12:09     ` Jan Stancek
  2023-03-09 21:02       ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2023-03-09 12:09 UTC (permalink / raw
  To: Petr Vorel; +Cc: ltp

On Thu, Mar 9, 2023 at 12:17 PM Jan Stancek <jstancek@redhat.com> wrote:
>
> On Thu, Mar 9, 2023 at 11:44 AM Petr Vorel <pvorel@suse.cz> wrote:
> >
> > Hi Jan,
> >
> > out of curiosity, what is main4() used for?
>
> It's from 086c14f7a465 ("The following hack fixes the
> "endian_switch01.c:115: warning: ‘main’ takes only zero or two
> arguments" warning. Signed-off-by: CAI Qian <caiqian@cclom.cn>.")
> but I'm not sure it is still used these days.
>
> As you found my misplaced TST_NO_DEFAULT_MAIN, that seems to confirm
> we can do without it. I'll have a look on a ppc system.

So I agree with your patch here. And then I'd suggest we follow it
with one that replaces main4 with

@@ -42,6 +42,9 @@ void check_le_switch_supported(void)
                exit(errno);
        }

+       if (!(getauxval(AT_HWCAP) & PPC_FEATURE_TRUE_LE))
+               tst_brk(TCONF, "Processor does not support little-endian mode");
+

What do you think?


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN
  2023-03-09 12:09     ` Jan Stancek
@ 2023-03-09 21:02       ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-03-09 21:02 UTC (permalink / raw
  To: Jan Stancek; +Cc: ltp

> On Thu, Mar 9, 2023 at 12:17 PM Jan Stancek <jstancek@redhat.com> wrote:

> > On Thu, Mar 9, 2023 at 11:44 AM Petr Vorel <pvorel@suse.cz> wrote:

> > > Hi Jan,

> > > out of curiosity, what is main4() used for?

> > It's from 086c14f7a465 ("The following hack fixes the
> > "endian_switch01.c:115: warning: ‘main’ takes only zero or two
> > arguments" warning. Signed-off-by: CAI Qian <caiqian@cclom.cn>.")
> > but I'm not sure it is still used these days.
+1

> > As you found my misplaced TST_NO_DEFAULT_MAIN, that seems to confirm
> > we can do without it. I'll have a look on a ppc system.

> So I agree with your patch here. And then I'd suggest we follow it
Thank you, I merged this patch.


> with one that replaces main4 with

> @@ -42,6 +42,9 @@ void check_le_switch_supported(void)
>                 exit(errno);
>         }

> +       if (!(getauxval(AT_HWCAP) & PPC_FEATURE_TRUE_LE))
> +               tst_brk(TCONF, "Processor does not support little-endian mode");
> +

> What do you think?

Indeed, that's looks to me better. You can add my ack to the patch.
But please test it.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2023-03-09 21:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-09 10:33 [LTP] [PATCH 1/1] endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN Petr Vorel
2023-03-09 10:44 ` Petr Vorel
2023-03-09 11:17   ` Jan Stancek
2023-03-09 12:09     ` Jan Stancek
2023-03-09 21:02       ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.