Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error: comparison of unsigned expression < 0 is always false #7455

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions thread/common/omrthreadattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "omrthreadattr.h"

#define J9THREAD_ATTR_IS_VALID(attr) ((attr) && (*(attr)) && ((*(attr))->size == sizeof(omrthread_attr)))
#define J9THREAD_VALUE_OUT_OF_RANGE(val, lo, hi) (((val) < (lo)) || ((val) > (hi)))

static intptr_t failedToSetAttr(intptr_t rc);

Expand Down Expand Up @@ -220,7 +219,7 @@ omrthread_attr_set_priority(omrthread_attr_t *attr, omrthread_prio_t priority)
return J9THREAD_ERR_INVALID_ATTR;
}

if (J9THREAD_VALUE_OUT_OF_RANGE(priority, J9THREAD_PRIORITY_MIN, J9THREAD_PRIORITY_MAX)) {
if (priority > J9THREAD_PRIORITY_MAX) {
return J9THREAD_ERR_INVALID_VALUE;
}

Expand Down
3 changes: 1 addition & 2 deletions thread/unix/omrthreadattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "unix/unixthreadattr.h"

#define J9THREAD_ATTR_IS_VALID(attr) ((attr) && (*(attr)) && ((*(attr))->size == sizeof(unixthread_attr)))
#define J9THREAD_VALUE_OUT_OF_RANGE(val, lo, hi) (((val) < (lo)) || ((val) > (hi)))

static intptr_t setStacksize(pthread_attr_t *pattr, uintptr_t stacksize);
static intptr_t setPriority(pthread_attr_t *pattr, omrthread_prio_t priority);
Expand Down Expand Up @@ -288,7 +287,7 @@ omrthread_attr_set_priority(omrthread_attr_t *attr, omrthread_prio_t priority)
return J9THREAD_SUCCESS;
}

if (J9THREAD_VALUE_OUT_OF_RANGE(priority, J9THREAD_PRIORITY_MIN, J9THREAD_PRIORITY_MAX)) {
if (priority > J9THREAD_PRIORITY_MAX) {
babsingh marked this conversation as resolved.
Show resolved Hide resolved
return J9THREAD_ERR_INVALID_VALUE;
}

Expand Down
3 changes: 1 addition & 2 deletions thread/zos390/omrthreadattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "unix/unixthreadattr.h"

#define J9THREAD_ATTR_IS_VALID(attr) ((attr) && (*(attr)) && ((*(attr))->size == sizeof(unixthread_attr)))
#define J9THREAD_VALUE_OUT_OF_RANGE(val, lo, hi) (((val) < (lo)) || ((val) > (hi)))

static intptr_t failedToSetAttr(intptr_t rc);

Expand Down Expand Up @@ -229,7 +228,7 @@ omrthread_attr_set_priority(omrthread_attr_t *attr, omrthread_prio_t priority)
return J9THREAD_ERR_INVALID_ATTR;
}

if (J9THREAD_VALUE_OUT_OF_RANGE(priority, J9THREAD_PRIORITY_MIN, J9THREAD_PRIORITY_MAX)) {
if (priority > J9THREAD_PRIORITY_MAX) {
return J9THREAD_ERR_INVALID_VALUE;
}

Expand Down