Re: Squid3 can't build on MS Visualstudio

From: Robert Collins <robertc@dont-contact.us>
Date: 01 Dec 2002 23:53:49 +1100

On Sun, 2002-12-01 at 05:11, Guido Serassio wrote:
> Hi,
>
> It seems that the current Squid3 can't be compiled using Microsoft
> VisualStudio, with both 6.0 and .NET versions
>
> Compiling...
> cache_cf.cc
> c:\work\nt-3.0\src\cf_parser.h(649) : fatal error C1061: compiler limit :
> blocks nested too deeply
> Error executing cl.exe.
>
> This is what MSDN reports on this error:
>
> Fatal Error C1061
> compiler limit : blocks nested too deeply
>
> The code includes blocks that are nested to a level greater than the
> compiler limit (128 levels of nesting). Simplify block nesting in the code.
>
> This means that the current if ... elseif ... elseif ... sequence in
> cf_parser.h is too long for C++ Microsoft compiler limit. Please note that
> in C mode this code compiles fine.
>
> Any hints on how resolve this problem ?

Yes. Long term we should have a custom parsing module, for both this and
http headers and any odd thing we need to parse. Anyway, before I
digress too much...

The code there is basically:

1) find matching config directive foo.
2) call the parser for foo.
3) return 1;

if no directive is found, return 0;

So...
the
if
elseif
elseif
elseif

can be replaced with
if () {
  ...
  return 1;
}
if () {
  ...
  return 1;
}
...
return 0;

Any decent optimiser should generate the same result for both styles,
and it will work around MS's broken thing.

Rob

Received on Sun Dec 01 2002 - 05:54:01 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:18:59 MST