tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

android-hardware-buffer-header-workaround.patch (1328B)


      1 From 3e5c4b07f9413822ec2dc82174a13abc59a7b6d2 Mon Sep 17 00:00:00 2001
      2 From: Mike Hommey <mh@glandium.org>
      3 Date: Tue, 8 Oct 2024 13:33:53 +0900
      4 Subject: [PATCH] [clang] Don't emit IntegerConstantExpression error on Android
      5 NDK headers
      6 
      7 The Android NDK versions before r28 have an enum value with a large
      8 shift count in hardware_buffer.h, which is undefined behavior and that
      9 is now caught as of #70307, and can't be overridden.
     10 
     11 This change relaxes the check to not apply to system headers on Android.
     12 ---
     13 clang/lib/Sema/SemaExpr.cpp | 5 ++++-
     14 1 file changed, 4 insertions(+), 1 deletion(-)
     15 
     16 diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
     17 index f930a21ea870..31b1a6e5292b 100644
     18 --- a/clang/lib/Sema/SemaExpr.cpp
     19 +++ b/clang/lib/Sema/SemaExpr.cpp
     20 @@ -17192,7 +17192,10 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
     21   }
     22 
     23   if (!Folded || !CanFold) {
     24 -    if (!Diagnoser.Suppress) {
     25 +    if (!Diagnoser.Suppress &&
     26 +        (!EvalResult.HasUndefinedBehavior ||
     27 +         !Context.getTargetInfo().getTriple().isAndroid() ||
     28 +         !getSourceManager().isInSystemHeader(DiagLoc))) {
     29       Diagnoser.diagnoseNotICE(*this, DiagLoc) << E->getSourceRange();
     30       for (const PartialDiagnosticAt &Note : Notes)
     31         Diag(Note.first, Note.second);
     32 -- 
     33 2.47.0.1.g59ce1bf855