W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 1999

Issues when compiling with MS VC++ 5.0

From: <gnelan@viasoft.com>
Date: Wed, 27 Oct 1999 14:20:27 -0700
To: html-tidy@w3.org
Message-ID: <07256817.0075452D.00@nwebcorp.viasoft.com>



Hello,

I am toying around with the idea of using tidy with some existing C++
code and have managed to compile it under MS VC++ 5.0 with just a few
problems that I thought I'd report here.  BTW, the 22Oct99 is *much*
better at this than the last version I tried (15Apr99).

====

In clean.c:

Bool HasOneChild(Node *node)
{
     return (node->content && node->content->next == null);
}

The C++ compiler complains about bool to Bool conversion.  Fix:

Bool HasOneChild(Node *node)
{
     return (Bool)((node->content && node->content->next == null));
}

====

Same issue in lexer.c:

Bool EndOfInput(Lexer *lexer)
{
     return  (feof(lexer->in->file));
}

====

Same issue in parser.c:

Bool IsNewNode(Node *node)
{
    if (node && node->tag)
    {
        return (node->tag->model & CM_NEW);
    }

    return yes;
}

====

In parser.c (ParseBody):

     ...

            /* avoid this error message being issued twice */
            if (!node->tag->model & CM_HEAD)
                ReportWarning(lexer, body, node, TAG_NOT_ALLOWED_IN);

     ...

                if (!node->tag->model & (CM_ROW | CM_FIELD))
                {
                    UngetToken(lexer);
                    return;
                }

I get the messages:

parser.c(2494) : warning C4806: '&' : unsafe operation: no value of
type 'bool' promoted to type 'const int' can equal the given constant

parser.c(2537) : warning C4806: '&' : unsafe operation: no value of
type 'bool' promoted to type 'const int' can equal the given constant

These look like bugs.  In the first case CM_HEAD is defined (1<<2)
which can never bit-and with 1.  Same thing for (CM_ROW | CM_FIELD).

====

I don't know how many folks are compiling tidy with C++ other than
myself but since it's so close to being compatible now I hope that
it stays that way.  Thanks for the good work.

Regards,
George Nelan
Received on Wednesday, 27 October 1999 17:22:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT