]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Shut up gcc 4.6.
authorVMware, Inc <>
Wed, 20 Jul 2011 20:41:37 +0000 (13:41 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Wed, 20 Jul 2011 20:41:37 +0000 (13:41 -0700)
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 <mvanzin@vmware.com>
12 files changed:
open-vm-tools/lib/file/fileStandAlone.c
open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c
open-vm-tools/lib/misc/vthreadBase.c
open-vm-tools/lib/rpcIn/rpcin.c
open-vm-tools/lib/string/bsd_vsnprintf.c
open-vm-tools/lib/string/bsd_vsnwprintf.c
open-vm-tools/libvmtools/vmtools.c
open-vm-tools/scripts/build/rpcgen_wrapper.sh.in
open-vm-tools/services/plugins/vix/vixTools.c
open-vm-tools/tests/vmrpcdbg/vmrpcdbg.c
open-vm-tools/xferlogs/xferlogs.c

index ac03eea992bf313ec9bd6f4b30e08ed576c4f380..009f680f8dac3f68b0353f3c23a1535e884ffbcf 100644 (file)
@@ -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, "//"))) {
index f6037dcedbba9352a340ec0f05e09c7c1e4d83da..d20f602180a04433bfddd21757ed3026dfcfa747 100644 (file)
@@ -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);
 }
index 48bf8b22b2ebd5e5a06d319c14403993ac7416c2..dd5257208541b292f2e4a8a1fd6e560fb909d0b7 100644 (file)
@@ -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;
index fada848dcfb6758e36be8b542b32f439f30875b3..8d9cc4b115afc0c4d8c53ecb1f5b5263e139b2df 100644 (file)
@@ -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. */
index 381c667d5b3dd3c6cc5b67362c01f0f41e2cf3fb..25d9251e936461e5f23a329a11ba7022af9d2bd4 100644 (file)
@@ -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;
index 703ee14598df684abbb176eb634d75c197538d55..e3e2ad2e23ec2e3f844d8e281e43589704007b47 100644 (file)
@@ -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) {
index afe42c0b49abae78a18755dc2cebe8edb7879d96..df0f910bc50e147dec212767348b188aad25b17d 100644 (file)
@@ -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) {
index 47228dda5a558cd5249b971ce71db9249c9b0520..d3307df500ea88893d576dcfd9d6d339ae1c08b6 100644 (file)
@@ -95,7 +95,7 @@ VMToolsDllInit(void *lib)
 #else
    (void) wiperData;
    success = Wiper_Init(NULL);
-   ASSERT(success);
+   ASSERT_NOT_IMPLEMENTED(success);
 #endif
 }
 
index b33696c84afe8539bd7cfd3947374a7e45ce9159..a6882d853048587e5366c448af669ea67d01ea54 100644 (file)
@@ -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
 
index 7b995f8c2167a111f46b7e620dd99a5998e367a3..89cc5fc52ccc92d4fe725abed4a671ba1b082f51 100644 (file)
@@ -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;
index e1e97efe1910b11158267f5b22731ecb6b6b4b55..84e241a0372be58bfa03747a8a4bc0ddf2725eaa 100644 (file)
@@ -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;
index 342d1f4cbdf7d0a0ff28af866ad8458ee09746d2..c15be20f1325563dfdcae9f066021d60ca487027 100644 (file)
@@ -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