Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: dbd546a32d5abe225306e22d43a7d86e3a042eee
      
https://github.com/tianocore/edk2/commit/dbd546a32d5abe225306e22d43a7d86e3a042eee
  Author: Pierre Gondois <[email protected]>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M BaseTools/Conf/tools_def.template

  Log Message:
  -----------
  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 <[email protected]>

Reviewed-by: Bob Feng<[email protected]>


  Commit: 17bd834eb5fd97699fbbcd146c7788df9e42030c
      
https://github.com/tianocore/edk2/commit/17bd834eb5fd97699fbbcd146c7788df9e42030c
  Author: Pierre Gondois <[email protected]>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M BaseTools/Conf/tools_def.template

  Log Message:
  -----------
  BaseTools: Factorize GCC flags

GCC48_ALL_CC_FLAGS has no dependency on GCC_ALL_CC_FLAGS.
By definition, there should be such dependency.

The outcomes of this patch is that GCC48_ALL_CC_FLAGS and
other dependent configurations will inherit from the
additional "-Os" flag.
The "-Os" flag optimizes a build in size, not breaking any
build. In a gcc command line, the last optimization flag
has precedence. This means that this "-Os" flag will be
overriden by a more specific optimization configuration,
provided that this more specific flag is appended at the
end of the CC_FLAGS.

Signed-off-by: Pierre Gondois <[email protected]>
Suggested-by: Tomas Pilar <[email protected]>

Reviewed-by: Bob Feng<[email protected]>


Compare: https://github.com/tianocore/edk2/compare/cb38ace64723...17bd834eb5fd


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to