Work around g++ atomic builtins detection in configure when -Os is used.
Assigning __sync_sub_and_fetch() result to an unused variable can result in it being optimized away and the function support is then not really tested for, see #4542. So do make sure this variable is kept by making it volatile. Closes #15555. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
37da97096b
commit
15a1c3b2ef
@ -16,7 +16,7 @@ AC_DEFUN([WX_ATOMIC_BUILTINS],
|
|||||||
__sync_fetch_and_add(&value, 2);
|
__sync_fetch_and_add(&value, 2);
|
||||||
__sync_sub_and_fetch(&value, 1);
|
__sync_sub_and_fetch(&value, 1);
|
||||||
/* but wxAtomicDec does, so mimic that: */
|
/* but wxAtomicDec does, so mimic that: */
|
||||||
unsigned int r2 = __sync_sub_and_fetch(&value, 1);
|
volatile unsigned int r2 = __sync_sub_and_fetch(&value, 1);
|
||||||
],
|
],
|
||||||
wx_cv_cc_gcc_atomic_builtins=yes,
|
wx_cv_cc_gcc_atomic_builtins=yes,
|
||||||
wx_cv_cc_gcc_atomic_builtins=no)
|
wx_cv_cc_gcc_atomic_builtins=no)
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -21867,7 +21867,7 @@ main ()
|
|||||||
__sync_fetch_and_add(&value, 2);
|
__sync_fetch_and_add(&value, 2);
|
||||||
__sync_sub_and_fetch(&value, 1);
|
__sync_sub_and_fetch(&value, 1);
|
||||||
/* but wxAtomicDec does, so mimic that: */
|
/* but wxAtomicDec does, so mimic that: */
|
||||||
unsigned int r2 = __sync_sub_and_fetch(&value, 1);
|
volatile unsigned int r2 = __sync_sub_and_fetch(&value, 1);
|
||||||
|
|
||||||
;
|
;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user