freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Metaware ARC compiler warnings


From: Allan Yang, Jian Hua - SH
Subject: [ft-devel] Metaware ARC compiler warnings
Date: Thu, 15 Nov 2007 13:40:57 +0800

I use compiler is Metaware hcarc4.5a, FT2 version is 2.3.5. I get the following compiler warnings:

 

1.   Warning 572:

w "freetype235/src/base/ftnames.c",L36/C53(#572):       face: Potentially dangerous pointer cast:

|    sizeof `struct TT_FaceRec_' ("freetype235/include/freetype/internal/tttypes.h",L1258/C19) differs from

|    sizeof `struct FT_FaceRec_' ("freetype235/include/freetype/freetype.h",L895/C19) and

|    accessing an lvalue through this pointer alias may violate assumptions

|    in the ANSI C Language Reference used by the optimizer.

|    (See (X3.159-1989 p.39,L18) on object access for more details.)

I search freetype-devel archive, find following message: http://lists.nongnu.org/archive/html/freetype-devel/2002-10/msg00080.html

So, I decide that disable the display of 572 warning message with pragam Offwarn:

CFLAGS     += -Hpragma=Offwarn(572)

 

 

 

 

2.   Warning 240:

w "freetype235/src/base/ftstream.c",L350/C22(#240):     Cast of type `FT_Byte *' to type `const signed char *'

|    may violate an assumption made by the optimizer.

|    To be safe, you should recompile your program at a lower

|    optimization level; or else, turn off the BEHAVED toggle.

As the warning message, turn off the BEHAVED toggle:

CFLAGS     += -Hoff=Behaved

About more information “BEHAVED”, see Metaware High C/C++ Programmer’s Guide (for ARC Tangent) 6.3.7:

(This is a similar version for IBM PowerPC on internet, see 6.2.5 Page192)

When it assumes that code is well-behaved, the compiler can be less conservative in generating code for pointer-based objects. Well-behaved code follows these rules:

.  The address of a union member is never assigned to a pointer.

.  A value of a pointer type is never cast to an incompatible pointer type.

 

Given these assumptions, the compiler might be able to generate substantially better code in referencing pointer-based variables. The compiler issues an appropriate warning if either of these assumptions is violated in such a way as to affect assumptions made by the optimizer. You must decide whether the warnings can be safely ignored or whether the program should be compiled at a lower optimization level.

 

Caution: The compiler might not catch all instances of misbehaved code. For example, a pointer-to-char might be passed to an undeclared (unprototyped) external function expecting a pointer-to-int. Therefore, it is possible for a program to compile at optimization level 6 without warnings (and run incorrectly), but run correctly when compiled at a lower optimization level.

 

You can manually request this optimization by turning On toggle Behaved.

 

 

 

 

3.    Warning:

w "freetype235/src/autofit/aflatin.c",L200: Variable "round" is possibly referenced before set.

My solution as bellowing:

        FT_Bool     round = 0;  /* make compiler happy */

 

 

 

 

 

Allan

 


reply via email to

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