Note that there are some explanatory texts on larger screens.

plurals
  1. POFree static checker for HiTech/Microchip C?
    text
    copied!<p>I'm writing a lot of code for the HiTech C compiler. I'm sure that my code would benefit from a static checker like <a href="http://www.splint.org/" rel="nofollow noreferrer">splint</a>, but splint itself trips up on some of HiTech's extensions, like <code>cp0</code> and <code>sfr</code> declarations. I can't just tell splint to skip the HiTech headers, though, because then it has no idea where most of my identifiers are from.</p> <p>Does anyone know of a static checker that can cope with this?</p> <p><b>Added:</b> examples of extensions: Mostly it's just new type qualifiers and absolute addressing, eg.</p> <pre><code>extern volatile cp0 unsigned int cp0_Config @ __REGADDR(16,0); extern volatile sfr unsigned long OC2R @ 0xBF803210; </code></pre> <p>(There's also the <code>persistent</code> type qualifier.)</p> <p>There are also the <code>interrupt</code> and <code>fast</code> qualifiers for functions:</p> <pre><code>void interrupt ExceptionHandler(void) @GENERAL_EXCEPTION { ... } </code></pre> <p><strong>Added:</strong></p> <p>I finally got around to trying Doug Currie's approach below. I used a shell script with SED to strip out any trailing "... @ ...;" absolute positioning declarations, and ran split with </p> <pre><code>splint -D__32MX460F512L__ -Dsfr= -Dcp0= -Dmips32r2= -I ~/HiTechStripped mymodule.c </code></pre> <p>Depending on the module, splint complains: </p> <pre><code>&lt; Location unknown &gt;: Field name reused: Code cannot be parsed. For help on parse errors, see splint -help parseerrors. (Use -syntax to inhibit warning) &lt; Location unknown &gt;: Previous use of &lt; Location unknown &gt;: Previous use of &lt; Location unknown &gt;: Previous use of [this goes on for about 100 lines...] </code></pre> <p>On other modules, I get:</p> <pre><code>../../../../HiTechStripped/stdlib.h:140:39: mismatched parentheses in #if Preprocessing error. (Use -preproc to inhibit warning) </code></pre> <p>It's wrong about this, as far as I can tell:</p> <pre><code>#if defined(_XA_) &amp;&amp; sizeof(double) == 8 </code></pre> <p>I think perhaps I should give up on the static checking. Thanks for the answers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload