This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Consolidate internal errno definitions.
ClosedPublic

Authored by alekseyshl on Jul 5 2017, 11:31 AM.

Details

Reviewers
eugenis
Summary

Move internal errno definitions to common to be shared by all sanitizers
and to be used by allocators.

Event Timeline

alekseyshl created this revision.Jul 5 2017, 11:31 AM

scudo_allocator.cpp could probably be changed here as well due to ENOMEM/EINVAL in scudoPosixMemalign.

scudo_allocator.cpp could probably be changed here as well due to ENOMEM/EINVAL in scudoPosixMemalign.

Yep, I was going to change all allocators in one patch.

krytarowski added inline comments.
lib/sanitizer_common/sanitizer_errno.inc
21 ↗(On Diff #105313)

Why 12, 16, 22?

eugenis added inline comments.Jul 5 2017, 4:07 PM
lib/sanitizer_common/sanitizer_errno.cc
26

Add COMPILER_CHECK()s for other errno codes instead of the test.

eugenis edited edge metadata.Jul 5 2017, 4:09 PM

Also, .inc is used for non-headers that are included in other non-headers, while sanitizer_errno.inc is a regular header.
But it you get rid of the test, you won't need it anyway.

alekseyshl added inline comments.Jul 5 2017, 4:16 PM
lib/sanitizer_common/sanitizer_errno.inc
21 ↗(On Diff #105313)

Cause I want literals instead of extern consts whenever possible. Was that the question?

krytarowski added inline comments.Jul 5 2017, 4:21 PM
lib/sanitizer_common/sanitizer_errno.inc
21 ↗(On Diff #105313)

I was wondering whether these values are portable.. but they happen to be the same on my platform (NetBSD). Please ignore.

Also, .inc is used for non-headers that are included in other non-headers, while sanitizer_errno.inc is a regular header.
But it you get rid of the test, you won't need it anyway.

It does not have header guards, it cannot be used anywhere else but in those two places, it does not seem like a regular header to me.

lib/sanitizer_common/sanitizer_errno.cc
26

I cannot include sanitizer_errno.h here, it will conflict with errno.h

lib/sanitizer_common/sanitizer_errno.inc
21 ↗(On Diff #105313)

Yep, that's what test was added for, to make sure they are the same.

alekseyshl updated this revision to Diff 105361.Jul 5 2017, 5:06 PM
alekseyshl marked an inline comment as done.
  • Get rid of .inc file and convert the test to compile time check.
alekseyshl updated this revision to Diff 105363.Jul 5 2017, 5:10 PM
  • Fix the header description.
eugenis accepted this revision.Jul 5 2017, 5:16 PM
This revision is now accepted and ready to land.Jul 5 2017, 5:16 PM
alekseyshl closed this revision.Jul 11 2017, 2:01 PM