Hello binutils team,

I've run across a difference between mc.exe and windmc output which seems
unintentional and results in compilation warnings. Essentially in the
generated header file windmc will use the last type (defined via
`MessageIdTypedef`) for all ids, whereas mc.exe will use the type defined
before each message. This behavior can be seen in Microsoft's example message
file <https://docs.microsoft.com/en-us/windows/win32/eventlog/message-files>
and comparing the header (and debug) output. I have also attached a minimal
example file.

This difference in behavior can result in header files with a category id
typecast of DWORD instead of WORD. This in turn causes compilation warnings
when using functions like ReportEvent with the customer flag set.

In testing against the master branch, the only parameter passed to
configure was `--with-windmc`. The invocations of windmc (as well as
mc.exe) were like this: `windmc -c -x . sample.mc`. I've been using mc.exe
from the latest Visual Studio 2019 (16.6.0) to compare behavior.

I did not see anything in the current bug list for windmc that covers this,
but fortunately the solution seems straightforward. I have attached a patch
with a minimal fix. The changes make the typecasting logic match mc.exe. I
will be happy to make any other requested adjustments as well.

Thanks!
Joel Anderson

Attachment: windmc-typedef.patch
Description: Binary data

Attachment: sample.mc
Description: Binary data

Reply via email to