[Mesa-dev] [PATCH 2/2] scons: don't add -Wmissing-field-initializers
Jose Fonseca
jfonseca at vmware.com
Wed Jan 25 05:34:16 PST 2012
----- Original Message -----
> The warning is absolutely useless. It doesn't actually say that there
> are
> uninitialized variables. It points out the fact that there are
> missing
> initializers and that variables are initialized to zero implicitly,
> which is
> exactly what we want and what we commonly make use of.
The warning has its uses. Imagine a structure is extended, but we forget to add initializer to fields.
struct bla {
int foo;
int boo;
int doo;
};
const bla = {FOO, BOO};
and 0 is not a valid balue for bla::doo.
Perhaps this use is infrequent enough to no be worth the warning noise.
I don't mind either way, and am happy to defer to the majority opinion.
> C90 and C99 require all unspecified variables in the initializer list
> to be set
> to zero. {} and {0} are valid alternatives to memset. Period.
Please don't use {}. It's not portable.
Jose
> ---
> scons/gallium.py | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/scons/gallium.py b/scons/gallium.py
> index 86adc3e..eed89cf 100755
> --- a/scons/gallium.py
> +++ b/scons/gallium.py
> @@ -364,10 +364,6 @@ def generate(env):
> '-Wmissing-prototypes',
> '-std=gnu99',
> ]
> - if distutils.version.LooseVersion(ccversion) >=
> distutils.version.LooseVersion('4.0'):
> - ccflags += [
> - '-Wmissing-field-initializers',
> - ]
> if distutils.version.LooseVersion(ccversion) >=
> distutils.version.LooseVersion('4.2'):
> ccflags += [
> '-Wpointer-arith',
> --
> 1.7.5.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list