title: Delphi disable warnings fails
body: <p>I have the following code in a Delphi 2007 application:</p>
  
  <pre><code>function TBaseCriteriaObject.RecursiveCount(
    ObjType: TBaseCriteriaObjectClass): integer;
  var    
    CurObj: TBaseCriteriaObject;
  begin
    result := 0;
  {$WARNINGS OFF}
    for CurObj in RecursiveChildren(ObjType) do
      Inc(Result);
  {$WARNINGS ON}
  end;
  </code></pre>
  
  <p>Which produces this warning:</p>
  
  <pre><code>[DCC Warning] BaseCriteriaObject.pas(255): H2077 Value assigned to 'CurObj' never used
  </code></pre>
  
  <p>I understand the warning but don't want to change the code, so how do I get rid of the warning because {$WARNINGS OFF} does not seem to work in this case?  </p>