Skip to contentSkip to conversation

Annotate tst_brk with noreturn

PATCH New Richard Palethorpe 3 participants 3 messages Nov 25, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Annotate tst_brk with noreturn

Prevents compiler warnings when tst_brk is placed at the end of a non-void function's control flow. Indeed tst_brk never returns control to the caller.

---
 include/tst_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/tst_test.h +1 -1
index c91d3f18a..b49243e4b 100644
@@ -70,7 +70,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
  */
 void tst_brk_(const char *file, const int lineno, int ttype,
               const char *fmt, ...)
-              __attribute__ ((format (printf, 4, 5)));
+              __attribute__ ((format (printf, 4, 5))) LTP_ATTRIBUTE_NORETURN;
 
 #define tst_brk(ttype, arg_fmt, ...)						\
 	({									\
Signature · 1 line
2.29.1
#1 lore raw

PATCH 1/1 Annotate tst_brk with noreturn

Hi Richard,

Quoted 14 lines

Prevents compiler warnings when tst_brk is placed at the end of a non-void function's control flow. Indeed tst_brk never returns control to the caller.

---
 include/tst_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/tst_test.h +0 -0
index c91d3f18a..b49243e4b 100644

include/tst_test.h void tst_resm_hexd_(const char *file, const int lineno, int ttype, · line 73

Quoted 5 lines
include/tst_test.h +1 -1
@@ -70,7 +70,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
  */
 void tst_brk_(const char *file, const int lineno, int ttype,
               const char *fmt, ...)
-              __attribute__ ((format (printf, 4, 5)));
+              __attribute__ ((format (printf, 4, 5))) LTP_ATTRIBUTE_NORETURN;

IMHO this is wrong since 6440c5d0d ("newlib: Allow SAFE_MACROS to be called from cleanup")

Kind regards,
Petr

#2 lore raw

PATCH 1/1 Annotate tst_brk with noreturn

In reply to Richard Palethorpe

Hi!

Quoted 3 lines

Prevents compiler warnings when tst_brk is placed at the end of a non-void function's control flow. Indeed tst_brk never returns control to the caller.

It actually does, in a case of SAFE_MACROS() called from test cleanup().

Which is the reason we cannot annotate the function because if we do so the compiler will not include the function epilog and tests would crash in a case that something went wrong in a cleanup().

Signature · 2 lines
Cyril Hrubis
[email protected]