diff options
| author | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | 2018-09-18 20:31:58 -0400 |
|---|---|---|
| committer | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | 2018-09-30 14:14:04 -0400 |
| commit | 23066c3f4e2146da8c7d1505729f4409f4d93d28 (patch) | |
| tree | e72ecbf474c663b3a4c432f4a92cd80a97e08b37 /scripts | |
| parent | 92676236917d8e2e0de1d8612686d3d04a6a245b (diff) | |
Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
Commit 217c3e019675 ("disable stringop truncation warnings for now")
disabled -Wstringop-truncation since it was too noisy.
Having __nonstring available allows us to let GCC know that a string
is not meant to be NUL-terminated, which helps suppressing some
-Wstringop-truncation warnings.
Note that using __nonstring actually triggers other warnings
(-Wstringop-overflow, which is on by default) which may be real
problems. Therefore, cleaning up -Wstringop-truncation warnings
also buys us the ability to uncover further potential problems.
To encourage the use of __nonstring, we put the warning back at W=1.
In the future, if we end up with a fairly warning-free tree,
we might want to enable it by default.
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # on top of v4.19-rc5, clang 7
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.extrawarn | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 8d5357053f86..b8f36f5f43f2 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn | |||
| @@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs) | |||
| 29 | warning-1 += $(call cc-option, -Wunused-but-set-variable) | 29 | warning-1 += $(call cc-option, -Wunused-but-set-variable) |
| 30 | warning-1 += $(call cc-option, -Wunused-const-variable) | 30 | warning-1 += $(call cc-option, -Wunused-const-variable) |
| 31 | warning-1 += $(call cc-option, -Wpacked-not-aligned) | 31 | warning-1 += $(call cc-option, -Wpacked-not-aligned) |
| 32 | warning-1 += $(call cc-option, -Wstringop-truncation) | ||
| 32 | warning-1 += $(call cc-disable-warning, missing-field-initializers) | 33 | warning-1 += $(call cc-disable-warning, missing-field-initializers) |
| 33 | warning-1 += $(call cc-disable-warning, sign-compare) | 34 | warning-1 += $(call cc-disable-warning, sign-compare) |
| 34 | 35 | ||
