You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: thirdparties/brpc/fix-gcc11.patch
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -56,17 +56,17 @@ index f8e1a491..b16d9487 100644
56
56
+++ b/docs/cn/thread_local.md
57
57
@@ -57,9 +57,9 @@ Use *p ... - still the errno of original pthread, undefined b
58
58
59
-
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:
-**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.**
62
-
+**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.**
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
65
-
-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.
66
-
+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.
-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.
69
-
+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.
0 commit comments