Skip to content

Commit

Permalink
merge: revert two patch files
Browse files Browse the repository at this point in the history
  • Loading branch information
koko2pp committed Oct 13, 2023
1 parent cb71e98 commit 078cc1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions thirdparties/brpc/brpc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ index 4ff38c5..b36de87 100644

+bool PrometheusMetricsDumper::DumpStatusJsonString(
+ const std::string& name, const std::string& desc) {
+ // If it is not in JSON format, return false; if it is in JSON format, print
+ // 如果不是json格式,返回false, 是json格式则print
+ BUTIL_RAPIDJSON_NAMESPACE::Document d;
+ if (desc.size() == 2) {
+ return false;
Expand All @@ -472,7 +472,7 @@ index 4ff38c5..b36de87 100644
+ std::string("# TYPE ") + name + std::string(" gauge\n") +
+ name + std::string("{");
+
+ // Traverse JSON and print
+ // 遍历json并打印
+ int count = 0;
+ BUTIL_RAPIDJSON_NAMESPACE::Value::MemberIterator it = d.MemberBegin();
+ while (it != d.MemberEnd()) {
Expand Down Expand Up @@ -2444,7 +2444,7 @@ index fe9055d..38dd7cb 100644
+
+ ASSERT_EQ("test4{name=\"haorooms\",address=\"word\"} 0\n", strformat);
+
+ // run result
+ // 运行结果
+ // [==========] Running 1 test from 1 test case.
+ // [----------] Global test environment set-up.
+ // [----------] 1 test from PrometheusMetricsDumperTest
Expand Down Expand Up @@ -3255,4 +3255,4 @@ index fc8bdf2c..020d5316 100644
-
#ifdef _MSC_VER
#define BAIDU_THREAD_LOCAL __declspec(thread)
#else
#else
18 changes: 9 additions & 9 deletions thirdparties/brpc/fix-gcc11.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ index f8e1a491..b16d9487 100644
+++ b/docs/cn/thread_local.md
@@ -57,9 +57,9 @@ Use *p ... - still the errno of original pthread, undefined b

Strictly speaking, this issue is not caused by gcc4, but rather by the inaccurate signature of __errno_location provided by glibc. A function that returns a thread-local pointer depends on the segment register (a common implementation of TLS), which can't truly be considered const. Since we haven't found a method to override __errno_location yet, the current practical solution for this issue is as follows:
严格地说这个问题不是gcc4导致的,而是glibc给__errno_location的签名不够准确,一个返回thread-local指针的函数依赖于段寄存器(TLS的一般实现方式),这怎么能算const呢?由于我们还未找到覆盖__errno_location的方法,所以这个问题目前实际的解决方法是:

-**Make sure to add `-D__const__=` to the gcc compilation options of projects that directly or indirectly use bthread, This defines `__const__`as empty, preventing gcc4 optimizations.**
+**Make sure to add `-D__const__=__unused__` to the gcc compilation options of projects that directly or indirectly use bthread, This defines `__const__`as empty, preventing gcc4 optimizations.**
-**务必在直接或间接使用bthread的项目的gcc编译选项中添加`-D__const__=`,即把`__const__`定义为空,避免gcc4做相关优化。**
+**务必在直接或间接使用bthread的项目的gcc编译选项中添加`-D__const__=__unused__`,即把`__const__`定义为空,避免gcc4做相关优化。**

Defining `__const__`as empty has minimal impact on other parts of the program. Additionally, if you're not **directly** using errno (meaning errno doesn't appear in your project), or if you're using GCC
-3.4,Even with GCC 3.4, the correctness of the program won't be affected even if you don't define`-D__const__=`,, but to safeguard against potential future issues, we strongly recommend adding it.
+3.4,Even with GCC 3.4, the correctness of the program won't be affected even if you don't define`-D__const__=__unused__`,, but to safeguard against potential future issues, we strongly recommend adding it.
`__const__`定义为空对程序其他部分的影响几乎为0。另外如果你没有**直接**使用errno(即你的项目中没有出现errno),或使用的是gcc
-3.4,即使没有定义`-D__const__=`,程序的正确性也不会受影响,但为了防止未来可能的问题,我们强烈建议加上。
+3.4,即使没有定义`-D__const__=__unused__`,程序的正确性也不会受影响,但为了防止未来可能的问题,我们强烈建议加上。

-It's important to note that, similar to errno, pthread_self also faces similar issues. However, in most cases, pthread_self serves little purpose beyond logging, and its impact is minimal. After defining`-D__const__=`, pthread_self will also function correctly.
+It's important to note that, similar to errno, pthread_self also faces similar issues. However, in most cases, pthread_self serves little purpose beyond logging, and its impact is minimal. After defining`-D__const__=__unused__`, pthread_self will also function correctly.
-需要说明的是,和errno类似,pthread_self也有类似的问题,不过一般pthread_self除了打日志没有其他用途,影响面较小,在`-D__const__=`后pthread_self也会正常。
+需要说明的是,和errno类似,pthread_self也有类似的问题,不过一般pthread_self除了打日志没有其他用途,影响面较小,在`-D__const__=__unused__`后pthread_self也会正常。
diff --git a/example/asynchronous_echo_c++/CMakeLists.txt b/example/asynchronous_echo_c++/CMakeLists.txt
index 91c3953f..74414e2a 100644
--- a/example/asynchronous_echo_c++/CMakeLists.txt
Expand Down Expand Up @@ -460,4 +460,4 @@ index e3367b0f..b43916b7 100644
+set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -D__STRICT_ANSI__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
use_cxx11()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/output/bin)


0 comments on commit 078cc1b

Please sign in to comment.