2.3.11. Specifying additional checks

The options described below give you control over the extent and rigor of the checks. Additional checking is an aid to portability and is good coding practice.

-fa

This option checks for certain types of data flow anomalies. The compiler performs data flow analysis as part of code generation. The checks indicate when an automatic variable might have been used before being assigned a value. The check is pessimistic and sometimes reports an anomaly where there is none. In general, it is useful at some stage to check all code using -fa.

-fh

This option checks that:

  • all external objects are declared before use

  • all file-scoped static objects are used

  • all predeclarations of static functions are used between their declaration and their definition. For example:

    static int f(void);
    static int f(void){return 1;}
    line 2: Warning: unused earlier static declaration of 'f'
    
  • external objects declared only in included header files are used in a source file.

These checks directly support good modular programming practices.

When writing production software, use the -fh option only in the later stages of program development. The extra diagnostics can be annoying in the earlier stages.

-fp

This option reports on explicit casts of integers to pointers, for example:

char *cp = (char *) anInteger;

This warning indicates potential portability problems. Casting explicitly between pointers and integers, although not clean, is not harmful on the ARM processor where both are 32-bit types. This option also causes casts to the same type to produce a warning. For example:


int f(int i) {return (int)i;} 
// Warning: explicit cast to same type.

-fv

This option reports on all unused declarations (including from standard headers).

-fx

This option enables all warnings normally suppressed by default, with the exception of the additional checks described in this section.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential