2011/12/02

VC7.1Sp1 causes faital error C1001 internal error at L.2708 of msc1.cpp

If a narrow-string-literal parser is set for grammar with wide-character-string iterator, VC7.1SP1 causes fatal error C1001 internal error at L.2708 of msc1.cpp on compiling boost.spirit (boost v1.48).
It is a clear bug, but the error message does not explain its reason.

  • /boost_1_48_0/boost/spirit/home/qi/meta_compiler.hpp(77) : fatal error C1001: internal error ('msc1.cpp', line 2708)

Spirit's lit<> can solve the error.

2011/05/14

Heap Memory Is Not Enough to Compile Spirit - Separate Definitions

VC's fatal error yields on compiling Spirit because its grammar is too large.

Fatal Error C1076

compiler limit : internal heap limit reached; use /Zm to specify a higher limit

I had already set large heap-memory size to the compile option /Zm. Then, I moved all the grammar-rules definition from a constructor to several member functions and separated them to different translation unit. It may not be the best solution, but it resolves the heap memory problem.

// Before
class grammar_t ...
{
    ...

    grammar_t() ... {
       rule1 = ...
       rule2 = ...
       ...  // heap memory is over
    }

    rule_t  rule1;
    rule_t  rule2;
    ...
}
// After
class grammar_t ...
{
    ...

    grammar_t() ... {
       def_rule1();
       def_rule2();
       ...
    }
    void def_rule1();
    void def_rule2();
    ...

    rule_t  rule1;
    rule_t  rule2;
    ...
}

// in each translation unit (different source file)
void grammar_t::def_rule1() { rule1 = ...; }
// in each translation unit (different source file)
void grammar_t::def_rule2() { rule2 = ...; }
...

2011/04/21

Boost.Spirit Comple Error Memo Using VC7.1

The following fatal errors occurs in Boost.Spirit.Qi using VC7.1.
The same source code can be compiled using VC10.

boost_1_46_1/boost/spirit/home/qi/meta_compiler.hpp(77) : fatal error C1001: internal compiler error
(compiler file 'msc1.cpp', line 2708)

qi/meta_compiler.hpp

    // Qi primitive meta-compiler
    template <>
    struct make_component
    {
        template 
        struct result;

        template 
        struct result
        {
            typedef typename qi::make_primitive<
                typename remove_const::type,
                typename remove_reference::type>::result_type
            type; // fatal error C1001 occurs here
        };

2011/01/03

cppcheck & understand

I am searching useful static code analyzer.

Firstly, I evaluated Understand that can check the MISRA's list automatically. Although I have MISRA-C++ pdf, manual check is not effective and not efficient. I think the Understand is so nice.
But, it is too expensive to buy it for personal programming!

Next, I tried to use the cppcheck. It can check less than the Understand; however, it is free. Cppcheck could not check several codes ... progress was freezed on its way. But, it found some mistakes. When finding more useful checker, I use cppcheck now. Inexpensive checkers that support C++ is few.

Thus, I do not buy the Understand and use cppcheck.

XPEG & Hyphen(-) at the Left Bound in a Class of PEG

develog - C++: Hyphen(-) should be put at the Left Bound in a Class of PEG

I caused such error again ... So, I wrote the class, sign as "[+-]".
In this case, my XPEG reported with non-straightforward message. Then I had to find the error by reading dumped trace log.

As I got burned at the error, I changed PEG format of XPEG and made XPEG allow it.

Range <- Char '-' !']' Char / Char

How to set parameters to debugging program on Visual Studio 2019 with CMake

Solution: MSDN Sometimes the "Debug and Launch Settings for CMake" bottun is disabled. In this case, change to the target view. ...