This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers] Do not define __has_feature in sanitizer/common_interface_defs.h
Needs ReviewPublic

Authored by jwakely on May 18 2023, 5:49 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Public headers intended for user code should not define __has_feature,
because this can break preprocessor checks done later in user code, e.g.
if they test #ifdef __has_feature to check for real support in the
compiler.

Replace the only use in the public header with a check for it being
supported before trying to use it. Define the fallback definition in the
internal headers, so that other internal sanitizer headers can continue
to use it as preferred.

This resolves a bug reported to GCC as https://gcc.gnu.org/PR109882

Diff Detail

Event Timeline

jwakely created this revision.May 18 2023, 5:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 5:49 AM
Herald added a subscriber: Enna1. · View Herald Transcript
jwakely requested review of this revision.May 18 2023, 5:49 AM
Herald added a subscriber: Restricted Project. · View Herald TranscriptMay 18 2023, 5:49 AM