diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2020-07-07 16:35:21 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-07-21 01:34:47 +0000 |
commit | dbd546a32d5abe225306e22d43a7d86e3a042eee (patch) | |
tree | e146bf34e27531d33d2c75cb053cc6104461dc78 /BaseTools/Source/Python | |
parent | cb38ace647231076acfc0c5bdd21d3aff43e4f83 (diff) | |
download | edk2-dbd546a32d5abe225306e22d43a7d86e3a042eee.tar.gz edk2-dbd546a32d5abe225306e22d43a7d86e3a042eee.tar.bz2 edk2-dbd546a32d5abe225306e22d43a7d86e3a042eee.zip |
BaseTools: Add gcc flag to warn on void* pointer arithmetic
By default, gcc allows void* pointer arithmetic.
This is a GCC extension.
However:
- the C reference manual states that void*
pointer "cannot be operands of addition
or subtraction operators". Cf s5.3.1
"Generic Pointers";
- Visual studio compiler treat such operation as
an error.
To prevent such pointer arithmetic, the "-Wpointer-arith"
flag should be set for all GCC versions.
The "-Wpointer-arith" allows to:
"Warn about anything that depends on the "size of"
a function type or of void. GNU C assigns these
types a size of 1, for convenience in calculations
with void * pointers and pointers to functions."
This flag is available since GCC2.95.3 which came out in 2001.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Bob Feng<bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python')
0 files changed, 0 insertions, 0 deletions