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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 25, 2014 at 4:11 PM, Thomas Graf <tgraf@xxxxxxx> 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

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.
        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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux