Skip to contentSkip to conversation

endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN

PATCH In review Petr Vorel 2 participants 5 messages Mar 9, 2023

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 endian_switch01.c: Remove useless TST_NO_DEFAULT_MAIN

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")
---
 testcases/kernel/syscalls/switch/endian_switch01.c | 2 --
 1 file changed, 2 deletions(-)
testcases/kernel/syscalls/switch/endian_switch01.c +0 -2
index bee35184a..eae193fc1 100644
@@ -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:
Signature · 5 lines
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

Hi Jan,

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

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 4 lines · Petr Vorel

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 <[email protected]>.") 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.

Quoted 4 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 7 lines · Jan Stancek
Quoted 4 lines · Petr Vorel

Hi Jan,

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

Quoted 7 lines

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 <[email protected]>.") 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?

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw
Quoted 12 lines · Jan Stancek
Quoted 11 lines · Petr Vorel
Quoted 4 lines

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 <[email protected]>.") but I'm not sure it is still used these days.

+1

Quoted 4 lines
Quoted 2 lines

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.

Quoted 11 lines

with one that replaces main4 with

(quoted diff) +3 -0
@@ -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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp