Fix VC++'s problems with re2c 0.16

- I'm surprised GCC didn't complain about all the struct/class mismatches.
- INFINITY is a macro in VC++ land, so rename it to INFINITI.
This commit is contained in:
Randy Heit 2016-02-06 21:19:05 -06:00
parent 43c6c9b5ee
commit f3ab0ff41b
7 changed files with 18 additions and 13 deletions

View file

@ -5,6 +5,11 @@ if( NOT CMAKE_CROSSCOMPILING )
include( CheckFunctionExists )
include( CheckTypeSize )
if( MSVC )
# Runtime type information is required
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR" )
endif()
set( PACKAGE_NAME re2c )
set( PACKAGE_TARNAME re2c )
set( PACKAGE_VERSION 0.16 )

View file

@ -10,8 +10,8 @@ namespace re2c
struct Go;
struct Span;
class State;
class OutputFile;
struct State;
struct OutputFile;
class BitMap
{

View file

@ -106,7 +106,7 @@ void DFA::emit_body (OutputFile & o, uint32_t& ind, const std::set<label_t> & us
for (State * s = head; s; s = s->next)
{
bool readCh = false;
emit_state (o, ind, s, used_labels.count (s->label));
emit_state (o, ind, s, used_labels.count (s->label) != 0);
emit_action (s->action, o, ind, readCh, s, cond, skeleton, used_labels, save_yyaccept);
s->go.emit(o, ind, readCh);
}

View file

@ -13,7 +13,7 @@ namespace re2c
{
class BitMap;
class State;
struct State;
struct If;
struct Span

View file

@ -12,7 +12,7 @@ namespace re2c
struct OutputFile;
class RuleOp;
class State;
struct State;
struct Initial
{

View file

@ -7,8 +7,8 @@
namespace re2c
{
static const size_t INFINITY = std::numeric_limits<size_t>::max();
static const size_t UNDEFINED = INFINITY - 1;
static const size_t INFINITI = std::numeric_limits<size_t>::max();
static const size_t UNDEFINED = INFINITI - 1;
static bool loopback(size_t node, size_t narcs, const size_t *arcs)
{
@ -38,12 +38,12 @@ static bool loopback(size_t node, size_t narcs, const size_t *arcs)
* - values in range [0 .. stack size] mean that this node is on stack
* (link to a node with the smallest index reachable from this one)
* - UNDEFINED means that this node has not been visited yet
* - INFINITY means that this node has already been popped off stack
* - INFINITI means that this node has already been popped off stack
*
* We use stack size (rather than topological sort index) as unique index
* of a node on stack. This is safe because indices of nodes on stack are
* still unique and less than indices of nodes that have been popped off
* stack (INFINITY).
* stack (INFINITI).
*
*/
static void scc(
@ -87,7 +87,7 @@ static void scc(
{
j = stack.top();
stack.pop();
lowlink[j] = INFINITY;
lowlink[j] = INFINITI;
}
while (j != i);
}

View file

@ -8,9 +8,9 @@
namespace re2c
{
struct Range;
struct RegExp;
struct RuleOp;
class Range;
class RegExp;
class RuleOp;
struct nfa_state_t
{