I suggest you ...

Dependency generation

I try to run lint before the compiler, generally the error message are more useful and of course lint is more through. However, my make makes use of automatic dependancy generation (the compiler generates a list of files that the source being compiled depends on). This mean I end up running the compiler twice. Once to generate the dependancy list before lint and a second time to generate code after lint.

This would all be well except that when the compiler runs into a problem during dependency generation it spits out obscure error messages. If I could get lint to do the dependancy generation I expect I would have better error messages and I might even be able to save a pass through the code.

3 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Robert shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Robert commented  · 

        I have done up a series of steps to make this work with the current version of PC-Lint. In the case it proves useful to someone here is what I have done

        Create a configuration file dep.lnt to configure lint to ignore errors but output include file information

        // Strip down so we can produce dependency list
        -e686 // yes, output may be meaningless
        -w0
        -ffn // Does not report full filename
        -vfs#h- // What to present as lint executes
        -vh
        -hsFa|3 // Message presentation
        -format=%("%f",%l\s\s%)%t\s%n:\s\s%m

        -header(c:/lint/unit_check.h)

        +program_info( output_prefix=depend_,-format_file="%[NAME]\n",format_type=,format_symbol=,format_macro=)

        Call this in the the makefile rule as

        $(base_lint_cmd) -I$(base_lint_dir)/lnt -I$(ccinc) $(vendorinc) $(projinc) $(base_lint_dir)/dep.lnt $(base_lint_dir)/iar-co-arm-v6.lnt project.lnt

        where

        base_lint_cmd=$(base_lint_dir)/lint-nt

        and the other variables define the configuration

        Finally the dependency rule becomes

        %.d: %.c
        $(depcmd) $<
        sed 's/ /\?/g' <depend_file.txt | sed 's/\\/\//g' | sed 's/[Cc]:/\/cygdrive\/c/g' | sed 's/^/$(*F).o $(*F).d $(*F).lob $(*F).tstexe $(*F).tstdexe: /g' > $(*F).d;

        Which runs lint to produce a file with the header files listed and then uses sed to massage that in a set of makefile rules of the following form

        main.o main.d main.lob main.tstexe main.tstdexe: main.c
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/lint/unit_check.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/lint/iar-ewarm-predefined_macros_for_PC-lint.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/stdint.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/ycheck.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/yvals.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/DLib_Defaults.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/Program?Files?(x86)/IAR?Systems/Embedded?Workbench?6.5/arm/INC/c/DLib_Config_Normal.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/DLib_Product.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/xencoding_limits.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/DLib_Threads.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/string.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/ysizet.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/DLib_Product_string.h
        main.o main.d main.lob main.tstexe main.tstdexe: bool.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/IAR/EW600/arm/inc/c/stdbool.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/TivaWare/inc/hw_memmap.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/TivaWare/driverlib/sysctl.h
        main.o main.d main.lob main.tstexe main.tstdexe: processor.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/TivaWare/inc/tm4c123fh6pm.h
        main.o main.d main.lob main.tstexe main.tstdexe: tsk.h
        main.o main.d main.lob main.tstexe main.tstdexe: tmrtsk.h
        main.o main.d main.lob main.tstexe main.tstdexe: /cygdrive/c/TivaWare/driverlib/timer.h
        main.o main.d main.lob main.tstexe main.tstdexe: spitsk.h
        main.o main.d main.lob main.tstexe main.tstdexe: cantsk.h
        main.o main.d main.lob main.tstexe main.tstdexe: comm_map.h

      Feedback and Knowledge Base