mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-29 11:17:28 +00:00
Change stack-use-after-return.cc to respect PTHREAD_STACK_MIN before calling pthread_attr_setstacksize. To investigate <https://reviews.llvm.org/D30267>. NFC.
llvm-svn: 298195
This commit is contained in:
parent
1be726a40d
commit
0d9b01fb95
@ -68,7 +68,12 @@ int main(int argc, char **argv) {
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
if (kStackSize > 0) {
|
||||
int ret = pthread_attr_setstacksize(&attr, kStackSize);
|
||||
size_t desired_stack_size = kStackSize;
|
||||
if (desired_stack_size < PTHREAD_STACK_MIN) {
|
||||
desired_stack_size = PTHREAD_STACK_MIN;
|
||||
}
|
||||
|
||||
int ret = pthread_attr_setstacksize(&attr, desired_stack_size);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "pthread_attr_setstacksize returned %d\n", ret);
|
||||
abort();
|
||||
@ -81,9 +86,9 @@ int main(int argc, char **argv) {
|
||||
abort();
|
||||
}
|
||||
|
||||
if (stacksize_check != kStackSize) {
|
||||
if (stacksize_check != desired_stack_size) {
|
||||
fprintf(stderr, "Unable to set stack size to %d, the stack size is %d.\n",
|
||||
kStackSize, stacksize_check);
|
||||
desired_stack_size, stacksize_check);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user