diff mbox

[v2] sparse: Make -Werror turn warnigns into errors

Message ID CANeU7QnM-sns1pOgjpOrKp2LkMnf7O=89XSvF7hCuzvrwg5bPw@mail.gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Christopher Li Sept. 27, 2014, 12:24 a.m. UTC
On Thu, Sep 25, 2014 at 4:11 PM, Thomas Graf <tgraf@suug.ch> wrote:
>
> @@ -467,6 +475,9 @@ static char **handle_onoff_switch(char *arg, char **next, const struct warning w
>                 }
>         }
>
> +       if (!strcmp(p, "error"))
> +               Werror = 1;
> +
>         // Prefixes "no" and "no-" mean to turn warning off.
>         if (p[0] == 'n' && p[1] == 'o') {
>                 p += 2;
> diff --git a/lib.h b/lib.h
> index f6cd9b4..dc01684 100644

While I apply the patch, I notice this piece. Sparse has the on/off switch list.
"Werror" seems should belong to that list. Gcc accept "-Wno-error" to turn off
the switch. However, we might not want "-Wsparse-all" to turn on "Werror".

So I have the incremental patch to convert "Werror" using the on/off
switch list.

Feed back?

Chris

        if (p[0] == 'n' && p[1] == 'o') {
                p += 2;
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thomas Graf Sept. 27, 2014, 7:11 a.m. UTC | #1
On 09/27/14 at 08:24am, Christopher Li wrote:
> While I apply the patch, I notice this piece. Sparse has the on/off switch list.
> "Werror" seems should belong to that list. Gcc accept "-Wno-error" to turn off
> the switch. However, we might not want "-Wsparse-all" to turn on "Werror".
> 
> So I have the incremental patch to convert "Werror" using the on/off
> switch list.
> 
> Feed back?

Sure
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Sept. 28, 2014, 2:32 a.m. UTC | #2
On Sat, Sep 27, 2014 at 3:11 PM, Thomas Graf <tgraf@suug.ch> wrote:
>> Feed back?
>
> Sure

Change pushed.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib.c b/lib.c
index 5203d98..8395662 100644
--- a/lib.c
+++ b/lib.c
@@ -439,6 +439,7 @@  static const struct warning {
        { "designated-init", &Wdesignated_init },
        { "do-while", &Wdo_while },
        { "enum-mismatch", &Wenum_mismatch },
+       { "error", &Werror },
        { "init-cstring", &Winit_cstring },
        { "non-pointer-null", &Wnon_pointer_null },
        { "old-initializer", &Wold_initializer },
@@ -470,14 +471,11 @@  static char **handle_onoff_switch(char *arg,
char **next, const struct warning

        if (!strcmp(p, "sparse-all")) {
                for (i = 0; i < n; i++) {
-                       if (*warnings[i].flag != WARNING_FORCE_OFF)
+                       if (*warnings[i].flag != WARNING_FORCE_OFF &&
warnings[i].flag != &Werror)
                                *warnings[i].flag = WARNING_ON;
                }
        }

-       if (!strcmp(p, "error"))
-               Werror = 1;
-
        // Prefixes "no" and "no-" mean to turn warning off.