This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add header file for ssize_t
ClosedPublic

Authored by ashay-github on Jan 6 2023, 10:44 AM.

Details

Summary

ssize_t is part of POSIX and not standard C/C++, so using ssize_t
without the necessary header files causes the build to fail on Windows
with the following error: 'ssize_t': undeclared identifier.

This patch includes llvm/Support/DataTypes.h to resolve the problem.

Diff Detail

Event Timeline

ashay-github created this revision.Jan 6 2023, 10:44 AM
ashay-github requested review of this revision.Jan 6 2023, 10:44 AM
zero9178 added a comment.EditedJan 6 2023, 11:04 AM

I think the correct header to include ssize_t seems to be llvm/Support/DataTypes.h, based on other usage throughout MLIR and LLVM. It defines ssize_t on Windows without including any Windows headers as well, which should generally be avoided from within headers (since they massively pollute the global namespace and even have hostile macro defines).

Also for future reference, Windows specific code should be guarded by the _WIN32 define, not _MSC_VER.

Thanks @zero9178! Updated the commit to incldue DataTypes.h.

ashay-github edited the summary of this revision. (Show Details)Jan 6 2023, 11:18 AM
ashay-github added a reviewer: zero9178.
zero9178 accepted this revision.Jan 6 2023, 11:36 AM

LGTM thanks!

This revision is now accepted and ready to land.Jan 6 2023, 11:36 AM

Thanks @zero9178! Would you be willing to land this change please? I don't have commit access.

Thanks @zero9178! Would you be willing to land this change please? I don't have commit access.

Sure. What git name and email should I use to author the commit?

Thanks! Could you attribute it to "Ashay Rane <ashay@users.noreply.github.com>"?

This revision was automatically updated to reflect the committed changes.