[all-commits] [llvm/llvm-project] c670cd: [sanitizers] Do not define __has_feature in saniti...

Jonathan Wakely via All-commits all-commits at lists.llvm.org
Sun Nov 5 15:23:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c670cdb968609d57dd490075cd3567402bba8eed
      https://github.com/llvm/llvm-project/commit/c670cdb968609d57dd490075cd3567402bba8eed
  Author: Jonathan Wakely <jwakely at redhat.com>
  Date:   2023-11-05 (Sun, 05 Nov 2023)

  Changed paths:
    M compiler-rt/include/sanitizer/asan_interface.h
    M compiler-rt/include/sanitizer/common_interface_defs.h
    M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h

  Log Message:
  -----------
  [sanitizers] Do not define __has_feature in sanitizer/common_interface_defs.h (#66628)

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




More information about the All-commits mailing list