-
Notifications
You must be signed in to change notification settings - Fork 243
Suppress some minor analysis warnings #593
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,6 +245,7 @@ while (c <= end) | |
| buffer[0] = new_start; | ||
| buffer[1] = new_end; | ||
| buffer += 2; | ||
| (void)buffer; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have some clearly useless assignments here, but they're OK to keep, because they ensure the buffer is correctly tracked if someone extends the function later. Easy suppression. |
||
| } | ||
| return result; | ||
| } | ||
|
|
@@ -330,6 +331,7 @@ while (*p != NOTACHAR) | |
| buffer[0] = start; | ||
| buffer[1] = get_highest_char(options); | ||
| buffer += 2; | ||
| (void)buffer; | ||
| } | ||
|
|
||
| return result; | ||
|
|
@@ -745,6 +747,7 @@ for (c = 0; c < 256; c++) | |
| { | ||
| prop = GET_UCD(c); | ||
| set_bit = FALSE; | ||
| (void)set_bit; | ||
|
|
||
| switch (ptype) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3070,7 +3070,7 @@ for (;;) | |
| if (codevalue == OP_BRAPOSZERO) | ||
| { | ||
| allow_zero = TRUE; | ||
| codevalue = *(++code); /* Codevalue will be one of above BRAs */ | ||
| ++code; /* The following opcode will be one of the above BRAs */ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clang is correct. We are writing a value to |
||
| } | ||
| else allow_zero = FALSE; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,7 @@ changed. This #define is a copy of the one in pcre2_internal.h. */ | |
|
|
||
| #include "pcre2.h" | ||
| #include "pcre2posix.h" | ||
| #include "pcre2_util.h" | ||
|
|
||
| /* Table to translate PCRE2 compile time error codes into POSIX error codes. | ||
| Only a few PCRE2 errors with a value greater than 23 turn into special POSIX | ||
|
|
@@ -194,7 +195,7 @@ if (preg != NULL && (int)preg->re_erroffset != -1) | |
| /* no need to deal with UB in snprintf */ | ||
| if (errbuf_size > INT_MAX) errbuf_size = INT_MAX; | ||
|
|
||
| /* there are 11 charactes between message and offset, | ||
| /* there are 11 characters between message and offset; | ||
| update message_len() if changed */ | ||
| ret = snprintf(errbuf, errbuf_size, "%s at offset %d", message, | ||
| (int)preg->re_erroffset); | ||
|
|
@@ -210,6 +211,8 @@ else | |
| ret = (int)len; | ||
| } | ||
|
|
||
| PCRE2_ASSERT(len > 0 || preg != NULL); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding an assertion here lets Clang reason about when |
||
|
|
||
| do { | ||
| if (ret < 0) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang is correct here. The assignment to
op_typeis provably a dead assignment. What's more... I reckon it hurts rather than helps, because if there's a branch in the code that should be assigning to op_type but forgets, this would suppress warnings about use-of-uninitialised!