summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2010-04-18 14:11:38 -0700
committerAaron Plattner <aplattner@nvidia.com>2010-04-19 12:45:14 -0700
commit999d8e8d1e430c62b5237e885836830e5f8b8d73 (patch)
tree51b5e1403fb9f129e378e16cdf6df7548d00026e
parentf0e8a1c429ab91c01de8805358f752a0ffe535d5 (diff)
tet: Fix the remaining warnings.
Add a TET_NORETURN attribute and tag various fatal functions with it. That fixes a few "int x; switch(...) { case C: x = blah; break; default: fatal() }" cases that result in uninitialized variable warnings. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--include/tet_api.h8
-rw-r--r--src/tet3/apilib/exit.c3
-rw-r--r--src/tet3/dtet2lib/genfatal.c2
-rw-r--r--src/tet3/dtet2lib/globals.c8
-rw-r--r--src/tet3/dtet2lib/rescode.c22
-rw-r--r--src/tet3/inc/dtetlib.h4
-rw-r--r--src/tet3/inc/error.h4
-rw-r--r--src/tet3/inc/globals.h5
-rw-r--r--src/tet3/llib/llib-lapi.c2
-rw-r--r--src/tet3/tcc/cleanup.c4
-rw-r--r--src/tet3/tcc/config.c6
-rw-r--r--src/tet3/tcc/error.c4
-rw-r--r--src/tet3/tcc/global.c5
-rw-r--r--src/tet3/tcc/journal.c4
-rw-r--r--src/tet3/tcc/scenario.c3
-rw-r--r--src/tet3/tcc/scenpp.c2
-rw-r--r--src/tet3/tcc/service.c1
-rw-r--r--src/tet3/tcc/tcc.h6
-rw-r--r--src/tet3/tcc/tool.c2
-rw-r--r--src/tet3/tcc/utils.c1
-rw-r--r--src/tet3/tcm/tcmfuncs.h1
21 files changed, 53 insertions, 44 deletions
diff --git a/include/tet_api.h b/include/tet_api.h
index b81e2990..1f70e287 100644
--- a/include/tet_api.h
+++ b/include/tet_api.h
@@ -240,6 +240,12 @@ extern "C" {
# define TET_PROTOLIST(list) ()
#endif
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
+# define TET_NORETURN __attribute__((noreturn))
+#else
+# define TET_NORETURN
+#endif /* GNUC */
+
/* NULL function pointer - may be used as an argument to tet_fork() */
#define TET_NULLFP ((void (*) ()) 0)
@@ -304,7 +310,7 @@ extern "C" {
/* functions in TETware-Lite and in Distrubuted TETware */
TET_IMPORT_FUNC(void, tet_delete, TET_PROTOLIST((int, char *)));
-TET_IMPORT_FUNC(void, tet_exit, TET_PROTOLIST((int)));
+TET_NORETURN TET_IMPORT_FUNC(void, tet_exit, TET_PROTOLIST((int)));
TET_IMPORT_FUNC(char *, tet_getvar, TET_PROTOLIST((char *)));
TET_IMPORT_FUNC(void, tet_infoline, TET_PROTOLIST((char *)));
TET_IMPORT_FUNC(int, tet_kill, TET_PROTOLIST((pid_t, int)));
diff --git a/src/tet3/apilib/exit.c b/src/tet3/apilib/exit.c
index b9d8fdc2..ad36e824 100644
--- a/src/tet3/apilib/exit.c
+++ b/src/tet3/apilib/exit.c
@@ -95,8 +95,7 @@ MODIFICATIONS:
** tet_exit() - log off all servers and exit
*/
-TET_IMPORT void tet_exit(status)
-int status;
+TET_IMPORT TET_NORETURN void tet_exit(int status)
{
tet_logoff();
exit(status);
diff --git a/src/tet3/dtet2lib/genfatal.c b/src/tet3/dtet2lib/genfatal.c
index e2b46fa1..c92ce63a 100644
--- a/src/tet3/dtet2lib/genfatal.c
+++ b/src/tet3/dtet2lib/genfatal.c
@@ -52,7 +52,7 @@ MODIFICATIONS:
** tet_genfatal() - generic fatal error handler
*/
-TET_IMPORT void tet_genfatal(int errnum, const char *file, int line, const char *s1, const char *s2)
+TET_IMPORT TET_NORETURN void tet_genfatal(int errnum, const char *file, int line, const char *s1, const char *s2)
{
(*tet_liberror)(errnum, file, line, s1, s2);
diff --git a/src/tet3/dtet2lib/globals.c b/src/tet3/dtet2lib/globals.c
index 0484a944..623ea568 100644
--- a/src/tet3/dtet2lib/globals.c
+++ b/src/tet3/dtet2lib/globals.c
@@ -61,11 +61,11 @@ TET_IMPORT int tet_mysysid = -1; /* my system ID */
TET_IMPORT char tet_root[MAXPATH]; /* TET_ROOT from the environment */
TET_IMPORT void (*tet_liberror) PROTOLIST((int, const char *, int, const char *, const char *));
/* ptr to error handler function */
-TET_IMPORT void (*tet_libfatal) PROTOLIST((int, const char *, int, const char *, const char *));
+TET_IMPORT TET_NORETURN void (*tet_libfatal) PROTOLIST((int, const char *, int, const char *, const char *));
/* ptr to fatal error handler */
/* static function declarations */
-static void minfatal PROTOLIST((int, const char *, int, const char *, const char *));
+static TET_NORETURN void minfatal PROTOLIST((int, const char *, int, const char *, const char *));
/*
@@ -84,7 +84,7 @@ static void minfatal PROTOLIST((int, const char *, int, const char *, const char
TET_IMPORT void tet_init_globals(const char *progname, int ptype, int sysid,
void (*liberror) PROTOLIST((int, const char *, int, const char *, const char *)),
- void (*libfatal) PROTOLIST((int, const char *, int, const char *, const char *)))
+ void TET_NORETURN (*libfatal) PROTOLIST((int, const char *, int, const char *, const char *)))
{
char *p;
@@ -116,7 +116,7 @@ TET_IMPORT void tet_init_globals(const char *progname, int ptype, int sysid,
** sufficient for use by the ASSERT() macro calls above
*/
-static void minfatal(int err, const char *file, int line, const char *s1, const char *s2)
+static TET_NORETURN void minfatal(int err, const char *file, int line, const char *s1, const char *s2)
{
if (tet_liberror)
(*tet_liberror)(err, file, line, s1, s2);
diff --git a/src/tet3/dtet2lib/rescode.c b/src/tet3/dtet2lib/rescode.c
index b689799f..08a7e7a8 100644
--- a/src/tet3/dtet2lib/rescode.c
+++ b/src/tet3/dtet2lib/rescode.c
@@ -72,14 +72,14 @@ MODIFICATIONS:
/* default result code table */
static struct restab restab_dflt[] = {
- "PASS", TET_PASS, 0,
- "FAIL", TET_FAIL, 0,
- "UNRESOLVED", TET_UNRESOLVED, 0,
- "NOTINUSE", TET_NOTINUSE, 0,
- "UNSUPPORTED", TET_UNSUPPORTED,0,
- "UNTESTED", TET_UNTESTED, 0,
- "UNINITIATED", TET_UNINITIATED,0,
- "NORESULT", TET_NORESULT, 0,
+ { "PASS", TET_PASS, 0 },
+ { "FAIL", TET_FAIL, 0 },
+ { "UNRESOLVED", TET_UNRESOLVED, 0 },
+ { "NOTINUSE", TET_NOTINUSE, 0 },
+ { "UNSUPPORTED", TET_UNSUPPORTED, 0 },
+ { "UNTESTED", TET_UNTESTED, 0 },
+ { "UNINITIATED", TET_UNINITIATED, 0 },
+ { "NORESULT", TET_NORESULT, 0 },
};
#define Nrestab_dflt (sizeof restab_dflt / sizeof restab_dflt[0])
@@ -99,9 +99,9 @@ struct statustab {
/* default status code table */
static struct statustab tet_statustab[] = {
- "PASS", TET_EXIT_SUCCESS,
- "FAIL", TET_EXIT_FAILURE,
- "SKIP", TET_EXIT_SKIP,
+ { "PASS", TET_EXIT_SUCCESS },
+ { "FAIL", TET_EXIT_FAILURE },
+ { "SKIP", TET_EXIT_SKIP },
};
#define Ntet_statustab (sizeof(tet_statustab) / sizeof(tet_statustab[0]))
diff --git a/src/tet3/inc/dtetlib.h b/src/tet3/inc/dtetlib.h
index bbf94564..a5e85651 100644
--- a/src/tet3/inc/dtetlib.h
+++ b/src/tet3/inc/dtetlib.h
@@ -54,6 +54,8 @@ MODIFICATIONS:
************************************************************************/
+#include "tet_api.h"
+
/* extern function declarations */
extern char **tet_addargv PROTOLIST((char **, char **));
extern int tet_addresult PROTOLIST((int, int));
@@ -71,7 +73,7 @@ extern int tet_fcopy PROTOLIST((char *, char *));
extern int tet_fgetargs PROTOLIST((FILE *, char **, int));
extern int tet_fioclex PROTOLIST((int));
extern void tet_generror PROTOLIST((int, char *, int, char *, char *));
-TET_IMPORT_FUNC(void, tet_genfatal,
+TET_NORETURN TET_IMPORT_FUNC(void, tet_genfatal,
PROTOLIST((int, const char *, int, const char *, const char *)));
TET_IMPORT_FUNC(int, tet_getargs, PROTOLIST((char *, char **, int)));
extern int tet_getdtablesize PROTOLIST((void));
diff --git a/src/tet3/inc/error.h b/src/tet3/inc/error.h
index 75a7ace4..1819ab17 100644
--- a/src/tet3/inc/error.h
+++ b/src/tet3/inc/error.h
@@ -48,10 +48,12 @@ MODIFICATIONS:
************************************************************************/
+#include "tet_api.h"
+
TET_IMPORT_FUNC_PTR(void, tet_liberror,
PROTOLIST((int, const char *, int, const char *, const char *)));
-TET_IMPORT_FUNC_PTR(void, tet_libfatal,
+TET_NORETURN TET_IMPORT_FUNC_PTR(void, tet_libfatal,
PROTOLIST((int, const char *, int, const char *, const char *)));
#define error(errnum, s1, s2) \
diff --git a/src/tet3/inc/globals.h b/src/tet3/inc/globals.h
index f5f37c33..02bab640 100644
--- a/src/tet3/inc/globals.h
+++ b/src/tet3/inc/globals.h
@@ -43,6 +43,8 @@ MODIFICATIONS:
************************************************************************/
+#include "tet_api.h"
+
TET_IMPORT_DATA(const char *, tet_progname); /* my program name */
TET_IMPORT_DATA(int, tet_mypid); /* my process ID */
TET_IMPORT_DATA(int, tet_myptype); /* my process type */
@@ -54,6 +56,5 @@ TET_IMPORT_ARRAY(char, tet_root, [MAXPATH]);
TET_IMPORT_FUNC(void, tet_init_globals, PROTOLIST((
const char *, int, int,
void (*) PROTOLIST((int, const char *, int, const char *, const char *)),
- void (*) PROTOLIST((int, const char *, int, const char *, const char *))
+ void TET_NORETURN (*) PROTOLIST((int, const char *, int, const char *, const char *))
)));
-
diff --git a/src/tet3/llib/llib-lapi.c b/src/tet3/llib/llib-lapi.c
index bc651a68..61fb8e6f 100644
--- a/src/tet3/llib/llib-lapi.c
+++ b/src/tet3/llib/llib-lapi.c
@@ -69,7 +69,7 @@ char *file, *argv[], *envp[];
return(0);
}
-void tet_exit(status)
+TET_NORETURN void tet_exit(status)
int status;
{
;
diff --git a/src/tet3/tcc/cleanup.c b/src/tet3/tcc/cleanup.c
index 64415809..3722bc7d 100644
--- a/src/tet3/tcc/cleanup.c
+++ b/src/tet3/tcc/cleanup.c
@@ -53,8 +53,7 @@ MODIFICATIONS:
** tcc_exit() - clean up and exit
*/
-void tcc_exit(status)
-int status;
+TET_NORETURN void tcc_exit(int status)
{
static int been_here;
@@ -81,4 +80,3 @@ int status;
/* log off servers, close connections and exit */
tet_exit(status);
}
-
diff --git a/src/tet3/tcc/config.c b/src/tet3/tcc/config.c
index 49855e30..2b21b0b3 100644
--- a/src/tet3/tcc/config.c
+++ b/src/tet3/tcc/config.c
@@ -1877,9 +1877,9 @@ static void cve_error(name, mode, sysid, text)
char *name, *text;
int mode, sysid;
{
- static char fmt1[] = "%.80s in %.40s assignment in the %s";
- static char fmt2[] = "%.14s for system %d";
- static char conf[] = "configuration";
+ static const char fmt1[] = "%.80s in %.40s assignment in the %s";
+ static const char fmt2[] = "%.14s for system %d";
+ static const char conf[] = "configuration";
char msg1[sizeof fmt1 + 80 + 40 + 14 + LNUMSZ];
char msg2[sizeof fmt2 + 14 + LNUMSZ];
char *p;
diff --git a/src/tet3/tcc/error.c b/src/tet3/tcc/error.c
index 25d1071b..74a1dbda 100644
--- a/src/tet3/tcc/error.c
+++ b/src/tet3/tcc/error.c
@@ -92,8 +92,8 @@ void tcc_error(int errnum, const char *file, int line, const char *s1,
** tcc_fatal() - TCC fatal error handler
*/
-void tcc_fatal(int errnum, const char *file, int line, const char *s1,
- const char *s2)
+TET_NORETURN void tcc_fatal(int errnum, const char *file, int line,
+ const char *s1, const char *s2)
{
tcc_error(errnum, file, line, s1, s2);
tcc_exit(1);
diff --git a/src/tet3/tcc/global.c b/src/tet3/tcc/global.c
index 52cd5c55..cd04c677 100644
--- a/src/tet3/tcc/global.c
+++ b/src/tet3/tcc/global.c
@@ -58,15 +58,11 @@ int tcc_modes;
*/
int tet_compat;
-/*
-
/* root directory for execution from TET_EXEC_ROOT
** used when the binaries are not in TET_ROOT
*/
char *tet_exec_root;
-/*
-
/* alternate execution directory on the local system
** from TET_EXECUTE in the environment or from the -a command-line option
*/
@@ -100,4 +96,3 @@ int tcc_timeout;
/* scenario error counter */
int scenerrors;
-
diff --git a/src/tet3/tcc/journal.c b/src/tet3/tcc/journal.c
index 6dd5a5c5..3a8cafd4 100644
--- a/src/tet3/tcc/journal.c
+++ b/src/tet3/tcc/journal.c
@@ -1058,7 +1058,7 @@ time_t now;
struct tm *tp = localtime(&now);
static char buf[DATESZ + 1];
- (void) sprintf(buf, "%4.4d%02.2d%02.2d",
+ (void) sprintf(buf, "%4.4d%.2d%.2d",
tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday);
return(buf);
@@ -1075,7 +1075,7 @@ time_t now;
struct tm *tp = localtime(&now);
static char buf[TIMESZ + 1];
- (void) sprintf(buf, "%02.2d:%02.2d:%02.2d",
+ (void) sprintf(buf, "%.2d:%.2d:%.2d",
tp->tm_hour, tp->tm_min, tp->tm_sec);
return(buf);
diff --git a/src/tet3/tcc/scenario.c b/src/tet3/tcc/scenario.c
index a4c11395..6f4e4208 100644
--- a/src/tet3/tcc/scenario.c
+++ b/src/tet3/tcc/scenario.c
@@ -54,6 +54,7 @@ MODIFICATIONS:
#include <errno.h>
# include <unistd.h>
#include "dtmac.h"
+#include "dtetlib.h"
#include "error.h"
#include "scentab.h"
#include "dirtab.h"
@@ -183,7 +184,7 @@ int execscen()
/* return now if the scenario is empty */
if (!sctree || !sctree->sc_child)
- return;
+ return status;
TRACE2(tet_Ttcc, 1, "about to execute scenario '%s'",
sctree->sc_scenario);
diff --git a/src/tet3/tcc/scenpp.c b/src/tet3/tcc/scenpp.c
index d287ece9..89da488f 100644
--- a/src/tet3/tcc/scenpp.c
+++ b/src/tet3/tcc/scenpp.c
@@ -480,7 +480,7 @@ struct scentab *ep;
** tcc_exit() - clean up and exit
*/
-void tcc_exit(status)
+TET_NORETURN void tcc_exit(status)
int status;
{
exit(status);
diff --git a/src/tet3/tcc/service.c b/src/tet3/tcc/service.c
index 763151d4..de99f11e 100644
--- a/src/tet3/tcc/service.c
+++ b/src/tet3/tcc/service.c
@@ -41,6 +41,7 @@ MODIFICATIONS:
#include <sys/types.h>
#include <time.h>
#include "dtmac.h"
+#include "dtetlib.h"
#include "error.h"
#include "proctab.h"
#include "scentab.h"
diff --git a/src/tet3/tcc/tcc.h b/src/tet3/tcc/tcc.h
index d939e719..133e76f0 100644
--- a/src/tet3/tcc/tcc.h
+++ b/src/tet3/tcc/tcc.h
@@ -39,6 +39,8 @@ MODIFICATIONS:
************************************************************************/
+#include "tet_api.h"
+
/* tell tcclib.h that it has been included in a tcc source file */
#define TCC 1
@@ -219,8 +221,8 @@ extern int tcc_access PROTOLIST((int, char *, int));
extern int tcc_chdir PROTOLIST((int, char *));
extern void tcc_dirname PROTOLIST((char *, char [], int));
extern void tcc_error PROTOLIST((int, const char *, int, const char *, const char *));
-extern void tcc_exit PROTOLIST((int));
-extern void tcc_fatal PROTOLIST((int, const char *, int, const char *, const char *));
+extern TET_NORETURN void tcc_exit PROTOLIST((int));
+extern TET_NORETURN void tcc_fatal PROTOLIST((int, const char *, int, const char *, const char *));
extern int tcc_kill PROTOLIST((int, long, int));
extern int tcc_mkdir PROTOLIST((int, char *));
extern int tcc_putenv PROTOLIST((int, char *));
diff --git a/src/tet3/tcc/tool.c b/src/tet3/tcc/tool.c
index 565a7371..c9d74e8e 100644
--- a/src/tet3/tcc/tool.c
+++ b/src/tet3/tcc/tool.c
@@ -660,7 +660,7 @@ int xrfnamelen;
const char *tcname = tet_basename(tcpath);
char logname[64];
- sprintf(logname, "%.*s.log", sizeof(logname) - 5, tcname);
+ sprintf(logname, "%.*s.log", (int)(sizeof(logname) - 5), tcname);
tcdirfname(tcpath, logname, xrfname, xrfnamelen);
}
diff --git a/src/tet3/tcc/utils.c b/src/tet3/tcc/utils.c
index 7a43f914..5507915e 100644
--- a/src/tet3/tcc/utils.c
+++ b/src/tet3/tcc/utils.c
@@ -48,6 +48,7 @@ MODIFICATIONS:
#include <ctype.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#include "dtmac.h"
#include "error.h"
#include "globals.h"
diff --git a/src/tet3/tcm/tcmfuncs.h b/src/tet3/tcm/tcmfuncs.h
index 2eac7525..e3e63270 100644
--- a/src/tet3/tcm/tcmfuncs.h
+++ b/src/tet3/tcm/tcmfuncs.h
@@ -45,6 +45,7 @@ MODIFICATIONS:
extern void tet_tcminit PROTOLIST((int, char **));
extern char *tet_callfuncname PROTOLIST((void));
extern void tet_check_apilib_version PROTOLIST((void));
+extern char *tet_getstatusname PROTOLIST((int));
#ifndef TET_LITE /* -START-LITE-CUT- */
extern int tet_tcmptype PROTOLIST((void));