From 078cc1b1e60ae63f29815e75a2ea2fa6d8690d2a Mon Sep 17 00:00:00 2001 From: koko2pp Date: Fri, 13 Oct 2023 17:04:22 +0800 Subject: [PATCH] merge: revert two patch files --- thirdparties/brpc/brpc.patch | 8 ++++---- thirdparties/brpc/fix-gcc11.patch | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/thirdparties/brpc/brpc.patch b/thirdparties/brpc/brpc.patch index d996d3587f..c6f1ba6604 100644 --- a/thirdparties/brpc/brpc.patch +++ b/thirdparties/brpc/brpc.patch @@ -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; @@ -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()) { @@ -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 @@ -3255,4 +3255,4 @@ index fc8bdf2c..020d5316 100644 - #ifdef _MSC_VER #define BAIDU_THREAD_LOCAL __declspec(thread) - #else + #else \ No newline at end of file diff --git a/thirdparties/brpc/fix-gcc11.patch b/thirdparties/brpc/fix-gcc11.patch index 52d4bea55a..d8d88172a1 100644 --- a/thirdparties/brpc/fix-gcc11.patch +++ b/thirdparties/brpc/fix-gcc11.patch @@ -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 @@ -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) - + \ No newline at end of file