From: VMware, Inc <> Date: Wed, 20 Jul 2011 20:41:37 +0000 (-0700) Subject: Shut up gcc 4.6. X-Git-Tag: 2011.07.19-450511~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=895358a6b6409631c1f1d2af00f1069ec1546966;p=thirdparty%2Fopen-vm-tools.git Shut up gcc 4.6. gcc 4.6 complains about "set but unused" variables by default with -Werror. Fix the code that triggers that warning. Also sneak in a fix to rpcgen_wrapper.sh. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/file/fileStandAlone.c b/open-vm-tools/lib/file/fileStandAlone.c index ac03eea99..009f680f8 100644 --- a/open-vm-tools/lib/file/fileStandAlone.c +++ b/open-vm-tools/lib/file/fileStandAlone.c @@ -220,13 +220,11 @@ File_SplitName(ConstUnicode pathName, // IN: Unicode bas; UnicodeIndex volEnd; UnicodeIndex length; - UnicodeIndex pathLen; UnicodeIndex baseBegin; + WIN32_ONLY(UnicodeIndex pathLen); ASSERT(pathName); - pathLen = Unicode_LengthInCodePoints(pathName); - /* * Get volume. */ @@ -234,6 +232,7 @@ File_SplitName(ConstUnicode pathName, // IN: volEnd = 0; #if defined(_WIN32) + pathLen = Unicode_LengthInCodePoints(pathName); if ((pathLen > 2) && (Unicode_StartsWith(pathName, "\\\\") || Unicode_StartsWith(pathName, "//"))) { diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index f6037dced..d20f60218 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -4085,7 +4085,6 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares * each search, if its base name is no longer within a share, remove it. */ for (i = 0; i < session->numSearches; i++) { - HgfsHandle handle; DblLnkLst_Links *l; if (DblLnkLst_IsLinked(&session->searchArray[i].links)) { @@ -4097,7 +4096,6 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares continue; } - handle = HgfsSearch2SearchHandle(&session->searchArray[i]); LOG(4, ("%s: Examining search (%s)\n", __FUNCTION__, session->searchArray[i].utf8Dir)); @@ -4545,9 +4543,10 @@ HgfsServerIsSharedFolderOnly(char const *cpName,// IN: Cross-platform filename ASSERT(cpName); inEnd = cpName + cpNameSize; - len = CPName_GetComponent(cpName, inEnd, &next); + ASSERT(len > 0); + (void) len; /* Shuts up gcc's -Werror=unused-but-set-variable. */ return (next == inEnd); } diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c index 48bf8b22b..dd5257208 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c @@ -593,7 +593,6 @@ HgfsChannelGuestBdSend(void *conn, // IN: our connection data HgfsSendFlags flags) // IN: Flags to say how to process { HgfsGuestConn *connData = conn; - unsigned char *packetOut = &connData->packetOut[0]; ASSERT(NULL != connData); ASSERT(NULL != packet); @@ -601,10 +600,6 @@ HgfsChannelGuestBdSend(void *conn, // IN: our connection data ASSERT(bufferLen <= HGFS_LARGE_PACKET_MAX && bufferLen <= packet->replyPacketSize); - if (connData->clientPacketOut != NULL) { - /* Client passed us an out buffer so use it. */ - packetOut = connData->clientPacketOut; - } ASSERT(bufferLen <= connData->packetOutLen); if (bufferLen > connData->packetOutLen) { bufferLen = connData->packetOutLen; diff --git a/open-vm-tools/lib/misc/vthreadBase.c b/open-vm-tools/lib/misc/vthreadBase.c index fada848dc..8d9cc4b11 100644 --- a/open-vm-tools/lib/misc/vthreadBase.c +++ b/open-vm-tools/lib/misc/vthreadBase.c @@ -962,10 +962,9 @@ VThreadBaseSimpleNoID(void) void *newNative = VThreadBaseGetNative(); HashTable *ht = VThreadBaseGetNativeHash(); VThreadBaseData *base; - VThreadBaseKeyType key; /* Require key allocation before TLS read */ - key = VThreadBaseGetKey(); + VThreadBaseGetKey(); /* Before allocating a new ID, try to reclaim any old IDs. */ for (newID = 0; @@ -1007,7 +1006,7 @@ VThreadBaseSimpleNoID(void) newKey = (void *)(uintptr_t)newID; result = HashTable_Insert(ht, newKey, newNative); - ASSERT(result); + ASSERT_NOT_IMPLEMENTED(result); } /* ID picked. Now do the important stuff. */ diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c index 381c667d5..25d9251e9 100644 --- a/open-vm-tools/lib/rpcIn/rpcin.c +++ b/open-vm-tools/lib/rpcIn/rpcin.c @@ -565,8 +565,11 @@ RpcInLoop(void *clientData) // IN char const *errmsg; char const *reply; size_t repLen; - Bool resched = FALSE; + +#if defined(VMTOOLS_USE_GLIB) unsigned int current; + Bool resched = FALSE; +#endif in = (RpcIn *)clientData; ASSERT(in); @@ -574,7 +577,9 @@ RpcInLoop(void *clientData) // IN ASSERT(in->channel); ASSERT(in->mustSend); -#if !defined(VMTOOLS_USE_GLIB) +#if defined(VMTOOLS_USE_GLIB) + current = in->delay; +#else /* * The event has fired: it is no longer valid. Note that this is * not true in the glib case! @@ -584,8 +589,6 @@ RpcInLoop(void *clientData) // IN in->inLoop = TRUE; - current = in->delay; - /* * This is very important: this is the only way to signal the existence of * this guest application to VMware. @@ -723,8 +726,10 @@ exit: if (in->shouldStop) { RpcInStop(in); in->shouldStop = FALSE; +#if defined(VMTOOLS_USE_GLIB) /* Force the GMainContext to unref the GSource that runs the RpcIn loop. */ resched = TRUE; +#endif } in->inLoop = FALSE; diff --git a/open-vm-tools/lib/string/bsd_vsnprintf.c b/open-vm-tools/lib/string/bsd_vsnprintf.c index 703ee1459..e3e2ad2e2 100644 --- a/open-vm-tools/lib/string/bsd_vsnprintf.c +++ b/open-vm-tools/lib/string/bsd_vsnprintf.c @@ -1452,7 +1452,6 @@ __find_arguments (const char *fmt0, va_list ap, union arg **argtable) int n, n2; /* handy integer (short term usage) */ char *cp; /* handy char pointer (short term usage) */ int flags; /* flags as above */ - int width; /* width from format (%8d), or 0 */ enum typeid *typetable; /* table of types */ enum typeid stattypetable [STATIC_ARG_TBL_SIZE]; int tablesize; /* current size of type table */ @@ -1520,7 +1519,6 @@ __find_arguments (const char *fmt0, va_list ap, union arg **argtable) fmt++; /* skip over '%' */ flags = 0; - width = 0; rflag: ch = *fmt++; reswitch: switch (ch) { @@ -1556,7 +1554,6 @@ __find_arguments (const char *fmt0, va_list ap, union arg **argtable) nextarg = n; goto rflag; } - width = n; goto reswitch; case 'h': if (flags & SHORTINT) { diff --git a/open-vm-tools/lib/string/bsd_vsnwprintf.c b/open-vm-tools/lib/string/bsd_vsnwprintf.c index afe42c0b4..df0f910bc 100644 --- a/open-vm-tools/lib/string/bsd_vsnwprintf.c +++ b/open-vm-tools/lib/string/bsd_vsnwprintf.c @@ -1297,7 +1297,6 @@ bsd_vsnwprintf(wchar_t **outBuf, size_t bufSize, const wchar_t *fmt0, int n, n2; /* handy integer (short term usage) */ wchar_t *cp; /* handy char pointer (short term usage) */ int flags; /* flags as above */ - int width; /* width from format (%8d), or 0 */ enum typeid *typetable; /* table of types */ enum typeid stattypetable [STATIC_ARG_TBL_SIZE]; int tablesize; /* current size of type table */ @@ -1364,7 +1363,6 @@ bsd_vsnwprintf(wchar_t **outBuf, size_t bufSize, const wchar_t *fmt0, fmt++; /* skip over '%' */ flags = 0; - width = 0; rflag: ch = *fmt++; reswitch: switch (ch) { @@ -1400,7 +1398,6 @@ bsd_vsnwprintf(wchar_t **outBuf, size_t bufSize, const wchar_t *fmt0, nextarg = n; goto rflag; } - width = n; goto reswitch; case 'h': if (flags & SHORTINT) { diff --git a/open-vm-tools/libvmtools/vmtools.c b/open-vm-tools/libvmtools/vmtools.c index 47228dda5..d3307df50 100644 --- a/open-vm-tools/libvmtools/vmtools.c +++ b/open-vm-tools/libvmtools/vmtools.c @@ -95,7 +95,7 @@ VMToolsDllInit(void *lib) #else (void) wiperData; success = Wiper_Init(NULL); - ASSERT(success); + ASSERT_NOT_IMPLEMENTED(success); #endif } diff --git a/open-vm-tools/scripts/build/rpcgen_wrapper.sh.in b/open-vm-tools/scripts/build/rpcgen_wrapper.sh.in index b33696c84..a6882d853 100644 --- a/open-vm-tools/scripts/build/rpcgen_wrapper.sh.in +++ b/open-vm-tools/scripts/build/rpcgen_wrapper.sh.in @@ -113,8 +113,8 @@ do_impl() case $output in - *.h) do_header ;; - *.c) do_impl ;; + *.h) do_header "$@" ;; + *.c) do_impl "$@" ;; *) echo "Unknown output file type: $output" ;; esac diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 7b995f8c2..89cc5fc52 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -5406,7 +5406,6 @@ VixToolsListFiles(VixCommandRequestHeader *requestMsg, // IN size_t resultBufferSize = 0; size_t lastGoodResultBufferSize = 0; int numFiles = 0; - int lastGoodNumFiles = 0; int fileNum; char *currentFileName; char *destPtr; @@ -5569,12 +5568,6 @@ VixToolsListFiles(VixCommandRequestHeader *requestMsg, // IN } if (resultBufferSize < maxBufferSize) { - /* - * lastGoodNumFiles is a count (1 based), while fileNum is - * an array index (zero based). So lastGoodNumFiles is - * fileNum + 1. - */ - lastGoodNumFiles = fileNum + 1; lastGoodResultBufferSize = resultBufferSize; } else { truncated = TRUE; @@ -5841,7 +5834,6 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg) // IN int64 tempTime; Bool timeAttributeSpecified = FALSE; Bool windowsAttributeSpecified = FALSE; - Bool posixAttributeSpecified = FALSE; int32 fileAttributeOptions = 0; #ifdef _WIN32 @@ -5881,12 +5873,6 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg) // IN fileAttributeOptions = setGuestFileAttributesRequest->fileOptions; - if ((fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_OWNERID) || - (fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_GROUPID) || - (fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_PERMISSIONS)) { - posixAttributeSpecified = TRUE; - } - if ((fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_HIDDEN) || (fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_READONLY)) { windowsAttributeSpecified = TRUE; @@ -5898,7 +5884,9 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg) // IN } #if defined(_WIN32) - if (posixAttributeSpecified) { + if ((fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_OWNERID) || + (fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_GROUPID) || + (fileAttributeOptions & VIX_FILE_ATTRIBUTE_SET_UNIX_PERMISSIONS)) { Debug("%s: Invalid attributes received for Windows Guest\n", __FUNCTION__); err = VIX_E_INVALID_ARG; diff --git a/open-vm-tools/tests/vmrpcdbg/vmrpcdbg.c b/open-vm-tools/tests/vmrpcdbg/vmrpcdbg.c index e1e97efe1..84e241a03 100644 --- a/open-vm-tools/tests/vmrpcdbg/vmrpcdbg.c +++ b/open-vm-tools/tests/vmrpcdbg/vmrpcdbg.c @@ -111,7 +111,7 @@ RpcDebugRun(ToolsAppCtx *ctx, ASSERT(suite != NULL); test = CU_add_test(suite, g_module_name(gPlugin), RpcDebugRunLoop); - ASSERT(test != NULL); + ASSERT_NOT_IMPLEMENTED(test != NULL); gLibRunData.ctx = ctx; gLibRunData.libData = ldata; diff --git a/open-vm-tools/xferlogs/xferlogs.c b/open-vm-tools/xferlogs/xferlogs.c index 342d1f4cb..c15be20f1 100644 --- a/open-vm-tools/xferlogs/xferlogs.c +++ b/open-vm-tools/xferlogs/xferlogs.c @@ -164,7 +164,7 @@ extractFile(char *filename) //IN: vmx log filename e.g. vmware.log char *ptrStr, *logInpFilename, *ver; int version; int filenu = 0; // output file enumerator - extractMode state = NOT_IN_GUEST_LOGGING; + DEBUG_ONLY(extractMode state = NOT_IN_GUEST_LOGGING); if (!(fp = fopen(filename, "rt"))) { @@ -186,7 +186,7 @@ extractFile(char *filename) //IN: vmx log filename e.g. vmware.log ASSERT(outfp == NULL); ASSERT(state == NOT_IN_GUEST_LOGGING); - state = IN_GUEST_LOGGING; + DEBUG_ONLY(state = IN_GUEST_LOGGING); /* * read the input filename, which was the filename written by the @@ -245,7 +245,7 @@ extractFile(char *filename) //IN: vmx log filename e.g. vmware.log } } else if (strstr(buf, LOG_END_MARK)) { // close the output file. ASSERT(state == IN_GUEST_LOGGING); - state = NOT_IN_GUEST_LOGGING; + DEBUG_ONLY(state = NOT_IN_GUEST_LOGGING); fclose(outfp); outfp = NULL; } else { // write to the output file