fix missing return in several files.]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
today I was digging a bit deeper into this source and find out following:tst_exit() is defined as __attribute__ ((noreturn)). That's hint for gcc compiler that this function never exits, so far it's good.
Problem in these two tests is that they pass tst_exit as cleanup function to tst_brkm(). But function tst_brkm() is not defined as __attribute__ ((noreturn)). So we have function that never retuns and we have the same problem again. The fix is trivial, instead of passing tst_exit() as cleanup function just call it directly.
Patch attached.
Signature · 2 lines
Cyril Hrubis [email protected]
testcases/kernel/io/aio/aio01/aio01.c +2 -1
@@ -426,7 +426,8 @@ void cleanup() {int main (void ) { -tst_brkm (TCONF , tst_exit,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_exit (); }#endif
testcases/kernel/io/aio/aio02/main.c +5 -3
@@ -23,18 +23,20 @@ int main(void) res =test_main ();printf ("test %s completed %s.\n" , test_name, - res ?"FAILED" :"PASSED" - ); + res ?"FAILED" :"PASSED" );fflush (stdout); return res ? 1 : 0; } +#else +char *TCID ="aio02/" TEST_NAME ;int TST_TOTAL =0 ;int main (void ) { -tst_brkm (TCONF , tst_exit,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_exit (); }#endif
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Quoted 12 lines
Well, in this case,
tst_brkm()looks like unnecessary here./* * If no cleanup function was specified, just return to the caller. * Otherwise call the specified function. If specified function * returns, call tst_exit(). */ if ( func != NULL ) { (*func)(); tst_exit(); }
Quoted 1 line
The
tst_exit()you just added will not be called anyway.
I'm passing NULL to tst_brkm, so we should never enter this code. But tst_brkm() calls tst_exit() in some circumstances so we should either add __atribute__ ((noreturn)) to tst_brkm too or remove tst_exit() from it.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
From: Cyril Hrubis <[email protected]>
Subject: Re: [LTP] [[email protected]: Re: [PATCH] fix missing return in several files.]
Date: Tue, 2 Jun 2009 02:14:51 +0200
Quoted 13 lines
Hi,
Quoted 12 lines
Well, in this case,
tst_brkm()looks like unnecessary here./* * If no cleanup function was specified, just return to the caller. * Otherwise call the specified function. If specified function * returns, call tst_exit(). */ if ( func != NULL ) { (*func)(); tst_exit(); }
Quoted 6 lines
Quoted 1 line
The
tst_exit()you just added will not be called anyway.I'm passing NULL to
tst_brkm, so we should never enter this code. Buttst_brkm()callstst_exit()in some circumstances so we should either add__atribute__((noreturn)) totst_brkmtoo or removetst_exit()from it.
OK. How about we do,
tst_resm(TCONF, "libaio missing"); tst_exit();
instead of,
tst_brkm(TCONF, NULL, "libaio missing"); tst_exit();
since I can't see the reason to use tst_brkm() in this case?
CAI Qian
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 10 lines
Quoted 4 lines
I'm passing NULL to
tst_brkm, so we should never enter this code. Buttst_brkm()callstst_exit()in some circumstances so we should either add__atribute__((noreturn)) totst_brkmtoo or removetst_exit()from it.OK. How about we do,
tst_resm(TCONF, "libaio missing"); tst_exit();
Quoted 6 lines
instead of,
tst_brkm(TCONF, NULL, "libaio missing"); tst_exit();since I can't see the reason to use
tst_brkm()in this case?
Sounds reasonable for this case, but I still think we should rethink which tst_* functions calls exit() or tst_exit() and if they needs __attribute__ ((noreturn)).
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi,
this problem has been forgotten for some time but it still makes trouble with too strict buildsystems.
See attached patch that also fixes minor style problems.
Signature · 2 lines
Cyril Hrubis [email protected]
testcases/kernel/io/aio/aio01/aio01.c +12 -8
@@ -68,9 +68,9 @@ int TST_TOTAL=6;#include <sys/time.h> #include <sys/resource.h> -void help (); -void setup (); -void cleanup (); +static void help (void ); +static void setup (void ); +static void cleanup (void );#define mapsize (1 << 14)
@@ -96,7 +96,8 @@ struct test_case_t { {0, "ftruncate mmaped file to 0 size"}, }; -int main (int argc,char **argv) { +int main (int argc,char **argv) +{int i, j, sec, usec;int failflag=0 ;int bflag=0 , nflag=0 , Fflag=0 ;
@@ -364,13 +365,15 @@ int main(int argc, char **argv) {return 0 ; } -void help () { +static void help (void ) +{printf (" -b n Buffersize\n" );printf (" -n n Number of requests\n" );printf (" -F s Filename to run the tests against\n" ); } -void setup () { +static void setup (void ) +{int ret;tst_sig (NOFORK ,DEF_HANDLER , cleanup);
@@ -411,7 +414,7 @@ void setup() { strerror(ret)); } -void cleanup () { +static void cleanup (void ) {TEST_CLEANUP ;free (dstbuf);free (srcbuf);
@@ -427,7 +430,8 @@ void cleanup() {int main (void ) { -tst_brkm (TCONF , tst_exit,"libaio missing" ); +tst_resm (TCONF ,"libaio missing" ); +tst_exit (); }#endif
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list