Need help with fatal C1509

H

Hendrik Schober

Hi,

I have some header files that contain macros in a special
syntax. These files are used with various tools that
extract information from these macros. One of these tools
is cl.exe.
Basically, these files contain this:

MYMACRO( ID4711, 4711, "str4711_1", "str4711_2" )
MYMACRO( ID4712, 4713, "str4712_1", "str4712_2" )
...

For cl.exe, this expands to:

NS::CSingleton::get().f( "str4711_1" "_" "str4711_2" , 4711 );
NS::CSingleton::get().f( "str4711_1" "_" "str4711_2" "_sfx" , 4712 );
NS::CSingleton::get().f( "str4713_1" "_" "str4713_2" , 4713 );
NS::CSingleton::get().f( "str4713_1" "_" "str4713_2" "_sfx" , 4714 );
...

where 'CSingleton' looks like this:

class CSingleton {
public:
CSingleton& get();
void f(const char*,unsigned int);
};

All this is included in a somewhat funny way to generate
some startup code:

void g()
{
#include "funny_header1.h"
#include "funny_header2.h"
#include "funny_header3.h"
#include "funny_header4.h"
...
}

I have long since split 'g()' into many small functions
each one including only a couple of the headers since
VC6 couldn't deal with all the code at once. Now some of
these headers seem to have grown beyond what VC7.1 can
handle. After about 240 of those macro lines, it gives
me:

fatal error C1509: compiler limit : too many exception handler states in function 'f()'. simplify function

While I think that splitting these headers would probably
help, this would be the last resort, since it messes up
processing these files with other the tools.
Instead I'm trying to find out how to cut the exception
handler states the compiler needs. How to tackle this?
I tried to change 'CSingleton' to this:

class CSingleton {
public:
CSingleton& get() throw();
void f(const char*,unsigned int) throw();
};

but this didn't help. The '__declspec(nothrow)' didn't
help either.

Is there anything else I can do?

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 
H

Hendrik Schober

Hendrik Schober said:
[...]
class CSingleton {
public:
CSingleton& get();

This should of course ne

static CSingleton& get();

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 
H

Hendrik Schober

Mihajlo Cvetanovic said:
Hendrik said:

You simply hit a compiler limit, there's no work-around for that. What
are you trying to do anyway? There must be a more elegant solution for
what you want...


Thanks for looking at this.
I found a solution by simplifying the code.

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top