From 1c45cc746e7484e72191fc8d010640692e90bc82 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Sun, 21 Nov 2010 21:29:11 -0500 Subject: [PATCH] Remove unreached lines Fix some macros to eliminate unreached trailing empty statements (such as: "{code = foo; goto error;};"), and other oddities causing "statement not reached" warnings. Also eliminate a couple of code blocks that were never reached. Change-Id: Iac626976268e13f5ef05f379ad1c9b5437c57f86 Reviewed-on: http://gerrit.openafs.org/3368 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/afs_disconnected.c | 1 - src/afs/afs_pioctl.c | 1 - src/bozo/bnode.c | 1 - src/bu_utils/fms.c | 5 +- src/bucoord/commands.c | 1 - src/bucoord/error_macros.h | 10 +- src/budb/error_macros.h | 15 +-- src/butc/dump.c | 5 - src/butc/error_macros.h | 15 +-- src/butc/recoverDb.c | 4 +- src/butm/error_macros.h | 10 +- src/butm/file_tm.c | 2 +- src/kauth/krb_tf.c | 216 ------------------------------------ src/rxgen/rpc_parse.c | 1 - src/ubik/ubik.c | 5 +- src/venus/up.c | 1 - src/vlserver/vlprocs.c | 10 +- src/vlserver/vlutils.c | 5 +- src/vol/clone.c | 5 +- src/vol/daemon_com_inline.h | 4 +- src/vol/fssync-debug.c | 4 +- src/vol/fssync_inline.h | 4 +- src/vol/namei_ops.c | 2 +- src/vol/volume.c | 4 +- src/vol/volume_inline.h | 4 +- src/volser/vos.c | 5 +- src/volser/vsprocs.c | 26 ++++- 27 files changed, 77 insertions(+), 289 deletions(-) diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 7f76064cb..9de6e8c53 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -185,7 +185,6 @@ afs_GetParentDirFid(struct vcache *avc, struct VenusFid *afid) break; default: return -1; - break; } return 0; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 5bd07d80a..f3f13fdbc 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -4362,7 +4362,6 @@ DECL_PIOCTL(PGetInitParams) return afs_pd_putBytes(aout, &cm_initParams, sizeof(struct cm_initparams)); - return 0; } #ifdef AFS_SGI65_ENV diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index 6dcd82341..374c7b29e 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -948,7 +948,6 @@ bnode_ParseLine(char *aline, struct bnode_token **alist) return 0; } } - return 0; } #define MAXVARGS 128 diff --git a/src/bu_utils/fms.c b/src/bu_utils/fms.c index 03ed62603..6d4878bb5 100644 --- a/src/bu_utils/fms.c +++ b/src/bu_utils/fms.c @@ -39,11 +39,10 @@ static int tt_fileMarkSize(struct cmd_syndesc *as, void *arock); afs_int32 rewindTape(usd_handle_t hTape); int dataBlock(usd_handle_t, afs_int32); -#define ERROR(evalue) \ - { \ +#define ERROR(evalue) do { \ code = evalue; \ goto error_exit; \ - } + } while (0) #define MAXV 100 diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index 8c61871dc..324510d65 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -1128,7 +1128,6 @@ bc_KillCmd(struct cmd_syndesc *as, void *arock) } statusPtr->flags |= ABORT_REQUEST; unlock_Status(); - return (0); } return 0; } diff --git a/src/bucoord/error_macros.h b/src/bucoord/error_macros.h index c1d0a5f77..aac6bd6cc 100644 --- a/src/bucoord/error_macros.h +++ b/src/bucoord/error_macros.h @@ -8,15 +8,13 @@ */ #undef ERROR -#define ERROR(evalue) \ - { \ +#define ERROR(evalue) do { \ code = evalue; \ goto error_exit; \ - } + } while (0) #undef ABORT -#define ABORT(evalue) \ - { \ +#define ABORT(evalue) do { \ code = evalue; \ goto abort_exit; \ - } + } while (0) diff --git a/src/budb/error_macros.h b/src/budb/error_macros.h index 99531be11..71c35c36e 100644 --- a/src/budb/error_macros.h +++ b/src/budb/error_macros.h @@ -7,20 +7,17 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -#define ERROR(evalue) \ - { \ +#define ERROR(evalue) do { \ code = evalue; \ goto error_exit; \ - } + } while (0) -#define ABORT(evalue) \ - { \ +#define ABORT(evalue) do { \ code = evalue; \ goto abort_exit; \ - } + } while (0) -#define BUDB_EXIT(evalue) \ - { \ +#define BUDB_EXIT(evalue) do { \ osi_audit(BUDB_ExitEvent, evalue, AUD_END); \ exit(evalue); \ - } + } while (0) diff --git a/src/butc/dump.c b/src/butc/dump.c index 2a41c396f..e1da036f3 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -160,11 +160,9 @@ calcExpirationDate(afs_int32 expType, afs_int32 expDate, afs_int32 createTime) */ Int32To_ktimeRelDate(expDate, &kd); return (Add_RelDate_to_Time(&kd, createTime)); - break; case BC_ABS_EXPDATE: return (expDate); - break; case BC_NO_EXPDATE: default: @@ -932,7 +930,6 @@ dumpPass(struct dumpRock * dparamsPtr, int passNumber) curDump->name, curDump->vid); curDump->hostAddr = 0; continue; - break; } if (e >= vldbEntry.nServers) { @@ -1024,7 +1021,6 @@ dumpPass(struct dumpRock * dparamsPtr, int passNumber) case 'r': /* retry */ dparamsPtr->curVolume--; /* redump this volume */ continue; - break; case 'o': /* omit */ ErrorLog(1, taskId, 0, 0, "Volume %s (%u) omitted\n", curDump->name, curDump->vid); @@ -1056,7 +1052,6 @@ dumpPass(struct dumpRock * dparamsPtr, int passNumber) dparamsPtr->curVolume--; /* redump this volume */ continue; - break; case DUMP_NORETRYEOT: ErrorLog(1, taskId, 0, 0, diff --git a/src/butc/error_macros.h b/src/butc/error_macros.h index 7042426d6..d9c199c24 100644 --- a/src/butc/error_macros.h +++ b/src/butc/error_macros.h @@ -7,23 +7,20 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -#define ERROR_EXIT(evalue) \ - { \ +#define ERROR_EXIT(evalue) do { \ code = evalue; \ goto error_exit; \ - } + } while (0) -#define ERROR_EXIT2(evalue) \ - { \ +#define ERROR_EXIT2(evalue) do { \ code = evalue; \ goto error_exit2; \ - } + } while (0) -#define ABORT_EXIT(evalue) \ - { \ +#define ABORT_EXIT(evalue) do { \ code = evalue; \ goto abort_exit; \ - } + } while (0) extern void ErrorLog(int debug, afs_int32 task, afs_int32 error1, afs_int32 error2, char *fmt, ...) diff --git a/src/butc/recoverDb.c b/src/butc/recoverDb.c index f7699f4a3..b5aa3b50a 100644 --- a/src/butc/recoverDb.c +++ b/src/butc/recoverDb.c @@ -191,7 +191,7 @@ scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr, tcode = NextFile(curTapePtr); /* guarantees we are at a filemark */ if (tcode) - ERROR_EXIT(tcode) + ERROR_EXIT(tcode); /* Read the FileBegin FileMark */ code = butm_ReadFileBegin(curTapePtr); @@ -248,7 +248,7 @@ scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr, ErrorLog(0, taskId, rcode, curTapePtr->error, "Can't read FileData on tape\n"); - ERROR_EXIT(rcode) + ERROR_EXIT(rcode); } hasdata[curr] = 1; *bytesRead += nbytes; diff --git a/src/butm/error_macros.h b/src/butm/error_macros.h index 7a387cf3b..f5e2f6327 100644 --- a/src/butm/error_macros.h +++ b/src/butm/error_macros.h @@ -7,14 +7,12 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -#define ERROR_EXIT(evalue) \ - { \ +#define ERROR_EXIT(evalue) do { \ code = evalue; \ goto error_exit; \ - } + } while (0) -#define ABORT_EXIT(evalue) \ - { \ +#define ABORT_EXIT(evalue) do { \ code = evalue; \ goto abort_exit; \ - } + } while (0) diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index 44c47ab99..d5390e85c 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -588,7 +588,7 @@ Rewind(usd_handle_t fid) return (USD_SEEK(fid, startOff, SEEK_SET, &stopOff)); } else { return (ForkIoctl(fid, USDTAPE_REW, 0)); - }; + } } /* prepare tape drive for access */ diff --git a/src/kauth/krb_tf.c b/src/kauth/krb_tf.c index 536a16b90..ed48dd50f 100644 --- a/src/kauth/krb_tf.c +++ b/src/kauth/krb_tf.c @@ -66,161 +66,6 @@ #include "kautils.h" #include "kauth_internal.h" -#ifndef WORDS_BIGENDIAN -/* This was taken from jhutz's patch for heimdal krb4. It only - * applies to little endian systems. Big endian systems have a - * less elegant solution documented below. - * - * This record is written after every real ticket, to ensure that - * both 32- and 64-bit readers will perceive the next real ticket - * as starting in the same place. This record looks like a ticket - * with the following properties: - * Field 32-bit 64-bit - * ============ ================= ================= - * sname "." "." - * sinst "" "" - * srealm ".." ".." - * session key 002E2E00 xxxxxxxx xxxxxxxx 00000000 - * lifetime 0 0 - * kvno 0 12 - * ticket 12 nulls 4 nulls - * issue 0 0 - */ -static unsigned char align_rec[] = { - 0x2e, 0x00, 0x00, 0x2e, 0x2e, 0x00, 0x00, 0x2e, - 0x2e, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 -}; - -#else /* AFSLITTLE_ENDIAN */ - -/* This was taken from asedeno's patch for MIT Kerberos. These - * alignment records are for big endian systems. We need more of them - * because the portion of the 64-bit issue_date that overlaps with the - * start of a ticket on 32-bit systems contains an unpredictable - * number of NULL bytes. Preceeding these records is a second copy of - * the 32-bit issue_date. The srealm for the alignment records is - * always one of ".." or "?.." - */ - -/* No NULL bytes - * This is actually two alignment records since both 32- and 64-bit - * readers will agree on everything in the first record up through the - * issue_date size, except where sname starts. - * Field (1) 32-bit 64-bit - * ============ ================= ================= - * sname "????." "." - * sinst "" "" - * srealm ".." ".." - * session key 00000000 xxxxxxxx 00000000 xxxxxxxx - * lifetime 0 0 - * kvno 0 0 - * ticket 4 nulls 4 nulls - * issue 0 0 - * - * Field (2) 32-bit 64-bit - * ============ ================= ================= - * sname "." "." - * sinst "" "" - * srealm ".." ".." - * session key 002E2E00 xxxxxxxx xxxxxxxx 00000000 - * lifetime 0 0 - * kvno 0 12 - * ticket 12 nulls 4 nulls - * issue 0 0 - * - */ -static unsigned char align_rec_0[] = { - 0x2e, 0x00, 0x00, 0x2e, 0x2e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x2e, 0x00, 0x00, 0x2e, 0x2e, 0x00, - 0x00, 0x2e, 0x2e, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -/* One NULL byte - * Field 32-bit 64-bit - * ============ ================= ================= - * sname "x" |"xx"|"xxx" "." - * sinst "xx."|"x."|"." ".." - * srealm ".." "..." - * session key 2E2E2E00 xxxxxxxx xxxxxxxx 00000000 - * lifetime 0 0 - * kvno 0 12 - * ticket 12 nulls 4 nulls - * issue 0 0 - */ -static unsigned char align_rec_1[] = { - 0x2e, 0x00, 0x2e, 0x2e, 0x00, 0x2e, 0x2e, 0x2e, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00 -}; - -/* Two NULL bytes - * Field 32-bit 64-bit - * ============ ================= ================= - * sname "x" |"x" |"xx" ".." - * sinst "" |"x" |"" "" - * srealm "x.."|".."|".." ".." - * session key 002E2E00 xxxxxxxx xxxxxxxx 00000000 - * lifetime 0 0 - * kvno 0 12 - * ticket 12 nulls 4 nulls - * issue 0 0 - */ - static unsigned char align_rec_2[] = { - 0x2e, 0x2e, 0x00, 0x00, 0x2e, 0x2e, 0x00, 0xff, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/* Three NULL bytes - * Things break here for 32-bit krb4 libraries that don't - * understand this alignment record. We can't really do - * anything about the fact that the three strings ended - * in the duplicate timestamp. The good news is that this - * only happens once every 0x1000000 seconds, once roughly - * every six and a half months. We'll live. - * - * Discussion on the krbdev list has suggested the - * issue_date be incremented by one in this case to avoid - * the problem. I'm leaving this here just in case. - * - * Field 32-bit 64-bit - * ============ ================= ================= - * sname "" "." - * sinst "" "" - * srealm "" ".." - * session key 2E00002E 2E00FFFF xxxx0000 0000xxxx - * lifetime 0 0 - * kvno 4294901760 917504 - * ticket 14 nulls 4 nulls - * issue 0 0 - */ -/* -static unsigned char align_rec_3[] = { - 0x2e, 0x00, 0x00, 0x2e, 0x2e, 0x00, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -*/ -#endif /* AFSLITTLE_ENDIAN */ - afs_int32 krb_write_ticket_file(char *realm) { @@ -303,67 +148,6 @@ krb_write_ticket_file(char *realm) close(fd); return 0; - /* Alignment Record, from MIT Kerberos */ -#ifndef WORDS_BIGENDIAN - if (write(fd, align_rec, sizeof(align_rec)) != sizeof(align_rec)) - goto bad; -#else /* AFSLITTLE_ENDIAN */ - { - int null_bytes = 0; - if (0 == (token.startTime & 0xff000000)) - ++null_bytes; - if (0 == (token.startTime & 0x00ff0000)) - ++null_bytes; - if (0 == (token.startTime & 0x0000ff00)) - ++null_bytes; - if (0 == (token.startTime & 0x000000ff)) - ++null_bytes; - - switch(null_bytes) { - case 0: - /* Issue date */ - if (write(fd, (char *) token.startTime, sizeof(afs_int32)) - != sizeof(afs_int32)) - goto bad; - if (write(fd, align_rec_0, sizeof(align_rec_0)) - != sizeof(align_rec_0)) - goto bad; - break; - - case 1: - /* Issue date */ - if (write(fd, (char *) &token.startTime, sizeof(afs_int32)) - != sizeof(afs_int32)) - goto bad; - if (write(fd, align_rec_1, sizeof(align_rec_1)) - != sizeof(align_rec_1)) - goto bad; - break; - - case 3: - /* Three NULLS are troublesome but rare. We'll just pretend - * they don't exist by decrementing the token.startTime. - */ - --token.startTime; - case 2: - /* Issue date */ - if (write(fd, (char *) &token.startTime, sizeof(afs_int32)) - != sizeof(afs_int32)) - goto bad; - if (write(fd, align_rec_2, sizeof(align_rec_2)) - != sizeof(align_rec_2)) - goto bad; - break; - - default: - goto bad; - } - } -#endif /* AFSLITTLE_ENDIAN */ - close(fd); - return 0; - - bad: close(fd); return -1; diff --git a/src/rxgen/rpc_parse.c b/src/rxgen/rpc_parse.c index a650bdbf2..eb4602149 100644 --- a/src/rxgen/rpc_parse.c +++ b/src/rxgen/rpc_parse.c @@ -182,7 +182,6 @@ get_definition(void) break; case TOK_EOF: return (NULL); - break; case TOK_PACKAGE: def_package(defp); break; diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index bd25f48b5..16584b60c 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -36,7 +36,10 @@ #include /* temporary hack by klm */ -#define ERROR_EXIT(code) {error=(code); goto error_exit;} +#define ERROR_EXIT(code) do { \ + error = (code); \ + goto error_exit; \ +} while (0) /*! * \file diff --git a/src/venus/up.c b/src/venus/up.c index f8ceb6ac5..b91105343 100644 --- a/src/venus/up.c +++ b/src/venus/up.c @@ -777,5 +777,4 @@ isMountPoint(char *name, struct ViceIoctl *blob) */ } } - return 4; } diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index cb61fef5e..06c9fbf12 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -43,9 +43,15 @@ extern int extent_mod; extern struct afsconf_dir *vldb_confdir; extern struct ubik_dbase *VL_dbase; int maxnservers; -#define ABORT(c) { errorcode = (c); goto abort; } +#define ABORT(c) do { \ + errorcode = (c); \ + goto abort; \ +} while (0) #undef END -#define END(c) { errorcode = (c); goto end; } +#define END(c) do { \ + errorcode = (c); \ + goto end; \ +} while (0) #define VLDBALLOCLIMIT 10000 #define VLDBALLOCINCR 2048 diff --git a/src/vlserver/vlutils.c b/src/vlserver/vlutils.c index 2ae3f2845..0dc6a5343 100644 --- a/src/vlserver/vlutils.c +++ b/src/vlserver/vlutils.c @@ -39,7 +39,10 @@ int vldbversion = 0; static int index_OK(struct vl_ctx *ctx, afs_int32 blockindex); -#define ERROR_EXIT(code) {error=(code); goto error_exit;} +#define ERROR_EXIT(code) do { \ + error = (code); \ + goto error_exit; \ +} while (0) /* Hashing algorithm based on the volume id; HASHSIZE must be prime */ afs_int32 diff --git a/src/vol/clone.c b/src/vol/clone.c index 6f7bce3ad..58912ff7e 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -54,7 +54,10 @@ int (*vol_PollProc) (void) = 0; /* someone must init this */ -#define ERROR_EXIT(code) {error = code; goto error_exit;} +#define ERROR_EXIT(code) do { \ + error = code; \ + goto error_exit; \ +} while (0) /* parameters for idec call - this could just be an IHandle_t, but leaving * open the possibility of decrementing the special files as well. diff --git a/src/vol/daemon_com_inline.h b/src/vol/daemon_com_inline.h index a6f5ea777..bd6124438 100644 --- a/src/vol/daemon_com_inline.h +++ b/src/vol/daemon_com_inline.h @@ -13,9 +13,7 @@ #include "daemon_com.h" #define SYNC_ENUMCASE(en) \ - case en: \ - return #en; \ - break + case en: return #en static_inline char * SYNC_res2string(afs_int32 response) diff --git a/src/vol/fssync-debug.c b/src/vol/fssync-debug.c index 7a6d576ea..9831883df 100644 --- a/src/vol/fssync-debug.c +++ b/src/vol/fssync-debug.c @@ -436,9 +436,7 @@ do_volop(struct state * state, afs_int32 command, SYNC_response * res) #define ENUMTOSTRING(en) #en #define ENUMCASE(en) \ - case en: \ - return ENUMTOSTRING(en); \ - break + case en: return ENUMTOSTRING(en) #define FLAGTOSTRING(fl) #fl #define FLAGCASE(bitstr, fl, str, count) \ diff --git a/src/vol/fssync_inline.h b/src/vol/fssync_inline.h index ce91dd73c..87c1a1fbb 100644 --- a/src/vol/fssync_inline.h +++ b/src/vol/fssync_inline.h @@ -13,9 +13,7 @@ #include "fssync.h" #define FSYNC_ENUMCASE(en) \ - case en: \ - return #en; \ - break + case en: return #en static_inline char * FSYNC_com2string(afs_int32 command) diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index e62a98620..f85c2bfae 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1513,7 +1513,7 @@ GetFreeTag(IHandle_t * ih, int vno) FDH_SYNC(fdP); FDH_UNLOCKFILE(fdP, offset); FDH_REALLYCLOSE(fdP); - return col;; + return col; badGetFreeTag: FDH_UNLOCKFILE(fdP, offset); diff --git a/src/vol/volume.c b/src/vol/volume.c index c85b6852b..cae075a97 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -8873,9 +8873,7 @@ VVLRUExtStats_r(struct VLRUExtStats * stats, afs_uint32 nvols) #define ENUMTOSTRING(en) #en #define ENUMCASE(en) \ - case en: \ - return ENUMTOSTRING(en); \ - break + case en: return ENUMTOSTRING(en) static char * vlru_idx_to_string(int idx) diff --git a/src/vol/volume_inline.h b/src/vol/volume_inline.h index b6f92cdce..dd48623bf 100644 --- a/src/vol/volume_inline.h +++ b/src/vol/volume_inline.h @@ -548,9 +548,7 @@ VChangeState_r(Volume * vp, VolState new_state) #endif /* AFS_DEMAND_ATTACH_FS */ #define VENUMCASE(en) \ - case en: \ - return #en; \ - break + case en: return #en /** * translate a ProgramType code to a string. diff --git a/src/volser/vos.c b/src/volser/vos.c index 6d83c1ece..62501ff31 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -97,7 +97,10 @@ cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\ cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\ cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL, "don't resolve addresses"); \ -#define ERROR_EXIT(code) {error=(code); goto error_exit;} +#define ERROR_EXIT(code) do { \ + error = (code); \ + goto error_exit; \ +} while (0) int rxInitDone = 0; struct rx_connection *tconn; diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index e96e81644..71870a18c 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -165,7 +165,10 @@ do { \ /* getting rid of this */ -#define ERROR_EXIT(code) {error=(code); goto error_exit;} +#define ERROR_EXIT(code) do { \ + error = (code); \ + goto error_exit; \ +} while (0) /* Protos for static routines */ @@ -3291,9 +3294,24 @@ DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part, return acode; } -#define ONERROR(ec, ep, es) if (ec) { fprintf(STDERR, (es), (ep)); error = (ec); goto rfail; } -#define ONERROR0(ec, es) if (ec) { fprintf(STDERR, (es)); error = (ec); goto rfail; } -#define ERROREXIT(ec) { error = (ec); goto rfail; } +#define ONERROR(ec, ep, es) do { \ + if (ec) { \ + fprintf(STDERR, (es), (ep)); \ + error = (ec); \ + goto rfail; \ + } \ +} while (0) +#define ONERROR0(ec, es) do { \ + if (ec) { \ + fprintf(STDERR, (es)); \ + error = (ec); \ + goto rfail; \ + } \ +} while (0) +#define ERROREXIT(ec) do { \ + error = (ec); \ + goto rfail; \ +} while (0) /* Get a "transaction" on this replica. Create the volume * if necessary. Return the time from which a dump should -- 2.39.5