VirtualBox

Changeset 24679 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 15, 2009 4:28:21 PM (15 years ago)
Author:
vboxsync
Message:

websrv-cpp.xsl: generate default case to shut up gcc's presumably correct bitching about using uninitialized variables e and v. The default case will return some value that is likely to be invalid. In debug builds it will assert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/webservice/websrv-cpp.xsl

    r23223 r24679  
    7272#include <VBox/version.h>
    7373
     74#include <iprt/assert.h>
    7475#include <iprt/initterm.h>
    7576#include <iprt/stream.h>
     
    168169      <xsl:call-template name="emitNewline" />
    169170    </xsl:for-each>
     171    <!-- Add a default case so gcc gives us a rest, esp. on darwin. -->
     172    <xsl:call-template name="emitNewlineIndent8" />
     173    <xsl:text>default:</xsl:text>
     174    <xsl:call-template name="emitNewlineIndent8" />
     175    <xsl:text>    AssertMsgFailed(("e=%d\n", (int)e));</xsl:text>
     176    <xsl:call-template name="emitNewlineIndent8" />
     177    <xsl:value-of select="concat('    v = (vbox__', $enumname, ')0x7fffdead;')" />
     178    <xsl:call-template name="emitNewlineIndent8" />
     179    <xsl:text>break; </xsl:text>
     180    <xsl:call-template name="emitNewline" />
    170181    <xsl:text>    }</xsl:text>
    171182    <xsl:call-template name="emitNewline" />
     
    202213      <xsl:call-template name="emitNewline" />
    203214    </xsl:for-each>
     215    <!-- Insert a default case so gcc gives us a rest, esp. on darwin. -->
     216    <xsl:call-template name="emitNewlineIndent8" />
     217    <xsl:text>default:</xsl:text>
     218    <xsl:call-template name="emitNewlineIndent8" />
     219    <xsl:text>    AssertMsgFailed(("v=%d\n", (int)v));</xsl:text>
     220    <xsl:call-template name="emitNewlineIndent8" />
     221    <xsl:value-of select="concat('    e = (', $enumname, '_T)0x7fffbeef;')" />
     222    <xsl:call-template name="emitNewlineIndent8" />
     223    <xsl:text>break; </xsl:text>
     224    <xsl:call-template name="emitNewline" />
    204225    <xsl:text>    }</xsl:text>
    205226    <xsl:call-template name="emitNewline" />
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette