tor-browser

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

0003-Replace-exception-throwing-code-by-abort-and-remove-.patch (5646B)


      1 From e1ad88a798617a42e1ed20c3c8360c10555cb8e8 Mon Sep 17 00:00:00 2001
      2 From: serge-sans-paille <sguelton@mozilla.com>
      3 Date: Tue, 13 May 2025 12:15:57 +0200
      4 Subject: [PATCH 3/5] Replace exception throwing code by abort, and remove
      5 try/catch
      6 
      7 ---
      8 .../core/optimizer/stft_decomposition.cc      |  3 +-
      9 .../core/session/provider_bridge_ort.cc       | 44 ++++---------------
     10 2 files changed, 10 insertions(+), 37 deletions(-)
     11 
     12 diff --git a/onnxruntime/core/optimizer/stft_decomposition.cc b/onnxruntime/core/optimizer/stft_decomposition.cc
     13 index 5c09e5225a..7d8c75025d 100644
     14 --- a/onnxruntime/core/optimizer/stft_decomposition.cc
     15 +++ b/onnxruntime/core/optimizer/stft_decomposition.cc
     16 @@ -31,7 +31,8 @@ constexpr static ONNX_NAMESPACE::TensorProto_DataType GetDataType() {
     17   } else if constexpr (std::is_same<T, int64_t>::value) {
     18     return ONNX_NAMESPACE::TensorProto_DataType_INT64;
     19   } else {
     20 -    throw std::logic_error("Invalid data type requested for STFT decomposition");
     21 +    abort();
     22 +    //throw std::logic_error("Invalid data type requested for STFT decomposition");
     23   }
     24 }
     25 
     26 diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc
     27 index 042598535e..9bed2cfcbc 100644
     28 --- a/onnxruntime/core/session/provider_bridge_ort.cc
     29 +++ b/onnxruntime/core/session/provider_bridge_ort.cc
     30 @@ -1701,11 +1701,9 @@ struct ProviderSharedLibrary {
     31 
     32 static ProviderSharedLibrary s_library_shared;
     33 
     34 -bool InitProvidersSharedLibrary() try {
     35 +bool InitProvidersSharedLibrary() {
     36   s_library_shared.Ensure();
     37   return true;
     38 -} catch (const std::exception&) {
     39 -  return false;
     40 }
     41 
     42 struct ProviderLibrary {
     43 @@ -1716,7 +1714,6 @@ struct ProviderLibrary {
     44 
     45   Provider& Get() {
     46     std::lock_guard<std::mutex> lock{mutex_};
     47 -    try {
     48       if (!provider_) {
     49         s_library_shared.Ensure();
     50 
     51 @@ -1730,10 +1727,6 @@ struct ProviderLibrary {
     52         provider_->Initialize();
     53       }
     54       return *provider_;
     55 -    } catch (const std::exception&) {
     56 -      Unload();  // If anything fails we unload the library and rethrow
     57 -      throw;
     58 -    }
     59   }
     60 
     61   void Unload() {
     62 @@ -2050,11 +2043,8 @@ ProviderInfo_OpenVINO* GetProviderInfo_OpenVINO() {
     63   return reinterpret_cast<ProviderInfo_OpenVINO*>(s_library_openvino.Get().GetInfo());
     64 }
     65 
     66 -ProviderInfo_TensorRT* TryGetProviderInfo_TensorRT() try {
     67 +ProviderInfo_TensorRT* TryGetProviderInfo_TensorRT() {
     68   return reinterpret_cast<ProviderInfo_TensorRT*>(s_library_tensorrt.Get().GetInfo());
     69 -} catch (const std::exception& exception) {
     70 -  LOGS_DEFAULT(ERROR) << exception.what();
     71 -  return nullptr;
     72 }
     73 
     74 ProviderInfo_TensorRT& GetProviderInfo_TensorRT() {
     75 @@ -2064,11 +2054,8 @@ ProviderInfo_TensorRT& GetProviderInfo_TensorRT() {
     76   ORT_THROW("TensorRT Provider not available, can't get interface for it");
     77 }
     78 
     79 -ProviderInfo_CUDA* TryGetProviderInfo_CUDA() try {
     80 +ProviderInfo_CUDA* TryGetProviderInfo_CUDA() {
     81   return reinterpret_cast<ProviderInfo_CUDA*>(s_library_cuda.Get().GetInfo());
     82 -} catch (const std::exception& exception) {
     83 -  LOGS_DEFAULT(ERROR) << exception.what();
     84 -  return nullptr;
     85 }
     86 
     87 ProviderInfo_CUDA& GetProviderInfo_CUDA() {
     88 @@ -2078,11 +2065,8 @@ ProviderInfo_CUDA& GetProviderInfo_CUDA() {
     89   ORT_THROW("CUDA Provider not available, can't get interface for it");
     90 }
     91 
     92 -ProviderInfo_CUDA* TryGetProviderInfo_CUDA_Test() try {
     93 +ProviderInfo_CUDA* TryGetProviderInfo_CUDA_Test() {
     94   return reinterpret_cast<ProviderInfo_CUDA*>(s_library_cuda_test.Get().GetInfo());
     95 -} catch (const std::exception& exception) {
     96 -  LOGS_DEFAULT(ERROR) << exception.what();
     97 -  return nullptr;
     98 }
     99 
    100 ProviderInfo_CUDA& GetProviderInfo_CUDA_Test() {
    101 @@ -2092,11 +2076,8 @@ ProviderInfo_CUDA& GetProviderInfo_CUDA_Test() {
    102   ORT_THROW("CUDA Provider not available, can't get interface for it");
    103 }
    104 
    105 -ProviderInfo_CANN* TryGetProviderInfo_CANN() try {
    106 +ProviderInfo_CANN* TryGetProviderInfo_CANN() {
    107   return reinterpret_cast<ProviderInfo_CANN*>(s_library_cann.Get().GetInfo());
    108 -} catch (const std::exception& exception) {
    109 -  LOGS_DEFAULT(ERROR) << exception.what();
    110 -  return nullptr;
    111 }
    112 
    113 ProviderInfo_CANN& GetProviderInfo_CANN() {
    114 @@ -2106,11 +2087,8 @@ ProviderInfo_CANN& GetProviderInfo_CANN() {
    115   ORT_THROW("CANN Provider not available, can't get interface for it");
    116 }
    117 
    118 -ProviderInfo_Dnnl* TryGetProviderInfo_Dnnl() try {
    119 +ProviderInfo_Dnnl* TryGetProviderInfo_Dnnl() {
    120   return reinterpret_cast<ProviderInfo_Dnnl*>(s_library_dnnl.Get().GetInfo());
    121 -} catch (const std::exception& exception) {
    122 -  LOGS_DEFAULT(ERROR) << exception.what();
    123 -  return nullptr;
    124 }
    125 
    126 ProviderInfo_Dnnl& GetProviderInfo_Dnnl() {
    127 @@ -2120,11 +2098,8 @@ ProviderInfo_Dnnl& GetProviderInfo_Dnnl() {
    128   ORT_THROW("oneDNN Provider not available, can't get interface for it");
    129 }
    130 
    131 -ProviderInfo_ROCM* TryGetProviderInfo_ROCM() try {
    132 +ProviderInfo_ROCM* TryGetProviderInfo_ROCM() {
    133   return reinterpret_cast<ProviderInfo_ROCM*>(s_library_rocm.Get().GetInfo());
    134 -} catch (const std::exception& exception) {
    135 -  LOGS_DEFAULT(ERROR) << exception.what();
    136 -  return nullptr;
    137 }
    138 
    139 ProviderInfo_ROCM& GetProviderInfo_ROCM() {
    140 @@ -2134,11 +2109,8 @@ ProviderInfo_ROCM& GetProviderInfo_ROCM() {
    141   ORT_THROW("ROCM Provider not available, can't get interface for it");
    142 }
    143 
    144 -ProviderInfo_MIGraphX* TryGetProviderInfo_MIGraphX() try {
    145 +ProviderInfo_MIGraphX* TryGetProviderInfo_MIGraphX() {
    146   return reinterpret_cast<ProviderInfo_MIGraphX*>(s_library_migraphx.Get().GetInfo());
    147 -} catch (const std::exception& exception) {
    148 -  LOGS_DEFAULT(ERROR) << exception.what();
    149 -  return nullptr;
    150 }
    151 
    152 ProviderInfo_MIGraphX& GetProviderInfo_MIGraphX() {
    153 -- 
    154 2.49.0