This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Diff 18 - Avoid name collision with Windows API.
ClosedPublic

Authored by mpividori on Dec 8 2016, 9:23 AM.

Details

Summary

Windows uses some macros to replace DeleteFile() by DeleteFileA() or DeleteFileW(). This was causing an error at link time.
I could have used "#undef DeleteFile", but I decided to change the function name to avoid future problem if we want to use Windows's function DeleteFile().

Diff Detail

Repository
rL LLVM

Event Timeline

mpividori updated this revision to Diff 80771.Dec 8 2016, 9:23 AM
mpividori retitled this revision from to [libFuzzer] Diff 18 - Avoid name collision with Windows API..
mpividori updated this object.
mpividori added reviewers: amccarth, zturner.
mpividori set the repository for this revision to rL LLVM.
mpividori added a subscriber: llvm-commits.
kcc accepted this revision.Dec 8 2016, 9:31 AM
kcc added a reviewer: kcc.
kcc added a subscriber: kcc.

LGTM
(and I will keep my opinion about preprocessor macros in windows API to myself)

This revision is now accepted and ready to land.Dec 8 2016, 9:31 AM
amccarth edited edge metadata.Dec 8 2016, 10:06 AM

I won't object to this change, but, in my experience, the #undef approach is better. It doesn't force you to compromise your API design, and it keeps the Windows-specific fixes local to the Windows-specific code.

If we were to #undef DeleteFile and later wanted to call the actual WinAPI DeleteFile, we'd just have to use the actual function name, either DeleteFileW or DeleteFileA, which modern code should be doing anyway.

This revision was automatically updated to reflect the committed changes.