Some minor corrections: don't use offsetof on a bitfield, and cast

printf operands to long to suppress warnings.

llvm-svn: 72404
This commit is contained in:
Eli Friedman 2009-05-25 21:38:01 +00:00
parent 02274a7171
commit 1cae3df3cf
1 changed files with 4 additions and 4 deletions

View File

@ -244,16 +244,16 @@ class TypePrinter:
raise NotImplementedError,'Cannot make tests values of type: "%s"'%(t,)
def printSizeOfType(self, prefix, name, t, output=None, indent=2):
print >>output, '%*sprintf("%s: sizeof(%s) = %%ld\\n", sizeof(%s));'%(indent, '', prefix, name, name)
print >>output, '%*sprintf("%s: sizeof(%s) = %%ld\\n", (long)sizeof(%s));'%(indent, '', prefix, name, name)
def printAlignOfType(self, prefix, name, t, output=None, indent=2):
print >>output, '%*sprintf("%s: __alignof__(%s) = %%ld\\n", __alignof__(%s));'%(indent, '', prefix, name, name)
print >>output, '%*sprintf("%s: __alignof__(%s) = %%ld\\n", (long)__alignof__(%s));'%(indent, '', prefix, name, name)
def printOffsetsOfType(self, prefix, name, t, output=None, indent=2):
if isinstance(t, RecordType):
for i,f in enumerate(t.fields):
if f.isPaddingBitField():
if f.isBitField():
continue
fname = 'field%d' % i
print >>output, '%*sprintf("%s: __builtin_offsetof(%s, %s) = %%ld\\n", __builtin_offsetof(%s, %s));'%(indent, '', prefix, name, fname, name, fname)
print >>output, '%*sprintf("%s: __builtin_offsetof(%s, %s) = %%ld\\n", (long)__builtin_offsetof(%s, %s));'%(indent, '', prefix, name, fname, name, fname)
def printValueOfType(self, prefix, name, t, output=None, indent=2):
if output is None: