Re: MSVC pedantry - compiler warning

"Geoff Air" <[email protected]> Mon, 30 Jan 2006 00:30:36 +1100
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
Hi Charles,

Thank you for the reply ...

Assume you meant -
#define ARG_UNUSED(x)

Doing this leads to many, MANY errors -
parser.c(1973) : error C2055:
expected formal parameter list, not a type list

I can not find anything similar to the __GNUC__ or
__INTEL_COMPILER, which allow an 'attribute', to be
added into the parameter list, like -
# define ARG_UNUSED(x) x __attribute__((unused))

There is an UNREFERENCED_PARAMETER macro in the windows.h
suite, but it has to be put in the body of the function,
not in the parameter list ...

The compiler can be fooled into thinking the parameter
is 'used' if it is placed in the body of the function,
even doing nothing, like -

   mode;

The formal parameter list is set in tag.h, now as -
typedef void (Parser)( TidyDocImpl* doc, Node *node, GetTokenMode mode );

Thus when MSVC sees, say -
void ParsePre( TidyDocImpl* doc, Node *pre, uint ARG_UNUSED(mode) )
after the macro is expanded it becomes
void ParsePre( TidyDocImpl* doc, Node *pre, uint mode )
which DOES NOT MATCH the NEW formal declaration in tag.h ...

Simply, Arnaud changed all of the functions in parser.c without
the ARG_UNUSED macro ... Why not change the rest? And be
fully consistent ...

That is all my patch does ...
https://sourceforge.net/tracker/index.php?func=detail&aid=1417439&group_id=27659&atid=390965

Regards,

Geoff.

EOF

_________________________________________________________________
Get FOXTEL this Summer – New low install price of only $29.95 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fadsfac%2Enet%2Flink%2Easp%3Fcc%3DFXT018%2E19119%2E0%26clk%3D1%26creativeID%3D28172&_t=752582449&_m=EXT



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642