freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] compiler warnings produced by the RVCT ARM compiler


From: Graham Asher
Subject: [ft-devel] compiler warnings produced by the RVCT ARM compiler
Date: Mon, 14 May 2007 12:08:08 +0100

Dear FreeTypers,

compiling FreeType 2.3.4 using an ARM compiler (part of the RealView
Compiler Tools suite: see
http://www.arm.com/pdfs/DUI0205G_rvct_compiler_and_libraries_guide.pdf) I
found some warnings and errors about the following things.

I enclose patched versions of all the files.

Unused variables, which can be removed, together with any statements that
refer to them, to get rid of compiler warnings. The warning is actually that
the variable is initialised but never used.

AF_Direction  up_dir in af_cjk_hints_compute_edges in afcjk.c (line 333).

FT_Pos   old_advance in afloader.c (line 173)

FT_Driver_Class   clazz in ftobjs.c (line 2224)

FT_Driver driver in ftobjs.c (line 2552)

FT_UInt version in ttkern.c (line 86)

FT_Stream stream in ttgload.c (line 1853)

cast to FT_Bool needed to avoid integer size mismatch at line 528 of
aflatin.c

Uses of jmp_buf, which may not exist (in some systems ft_jmp_buf may be
defined as something else) in ftobjs.c at lines 93 and 99. These must be
changed to ft_jmp_buf.

Variable possibly used before being initialised: FT_Stream stream at line
1198 of ftobjs.c; this can be fixed by initialising it to NULL. (There's
another case in afmparse.c: FT_Int n at line 923).

Unreachable code in various places in ftobjs.c and afmparse.c caused by the
sequences

goto <label>;
break;

return;
break;

etc.

Problems with VARIANT_BIT in psmodule.c: warnings about sign change caused
by integer conversion.

1. It should be unsigned, so it is better defined using 0x80000000UL.

2. The bit should be set using bitwise or ( | ) rather than exclusive or ( ^
).

A cast is needed in ttcmap.c to cast away the 'volatile' qualifier.

Finally, in many environments, using the ctype.h functions isalpha, isdigit,
etc., will cause writable global variables to be used. These functions are
locale-dependent, therefore the standard library will often store the type
table, or a pointer to it, as a writable global.

I found it necessary to replace the inclusion of ctype.h in ftsldlib.h with
the following:

#define ft_islower(C) ((C) >= 'a' && (C) <= 'z')
#define ft_isupper(C) ((C) >= 'A' && (C) <= 'Z')
#define ft_isdigit(C) ((C) >= '0' && (C) <= '9')
#define ft_isalnum(C) (ft_islower(C) || ft_isupper(C) || ft_isdigit(C))
#define ft_isxdigit(C) (ft_isdigit(C) || ((C) >= 'a' && (C) <= 'f') || ((C)
>= 'A' && (C) <= 'F'))

which may not be as fast as the standard versions but are very likely
adequate.

Best wishes,

Graham Asher

Attachment: ft234-ARM-patches.zip
Description: Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]