Andrew: BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c is LZMA code. BaseTools/Source/C/LzmaCompress/LzmaCompress.c is BaseTools wrap code.
Thanks Liming -----Original Message----- From: Andrew Fish [mailto:[email protected]] Sent: Wednesday, August 27, 2014 8:06 AM To: [email protected] Subject: Re: [edk2] [BaseTools][PATCH 3/5] Fix clang warnings about asigning a void * to its self. On Aug 26, 2014, at 4:52 PM, Bruce Cran <[email protected]> wrote: > On 8/26/2014 5:37 PM, Andrew Fish wrote: >> -static void *SzAlloc(void *p, size_t size) { p = p; return >> MyAlloc(size); } -static void SzFree(void *p, void *address) { p = p; >> MyFree(address); } >> +static void *SzAlloc(void *p, size_t size) { return MyAlloc(size); } >> +static void SzFree(void *p, void *address) { MyFree(address); } > > I guess some compiler was (is?) warning about 'p' being unused, so > should there instead be a cast to void? i.e. (void)p; The error is: LzmaCompress.c:46:49: error: explicitly assigning a variable of type 'void *' to itself [-Werror,-Wself-assign] static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } I'm not sure if any of our tools warn. It probably came from the original LZMA code? It looks like I can turn on the -Wno-self-assign compiler flag and suppress the warning. Which brings up a good point about this patch set. Assuming I remove patch 3 and replace it with a compiler flag change the only risk change is to the compiler flags. I'm going to need help testing changing the compiler flags, in BaseTools/Source/C/Makefiles/header.makefile , with all the flavors of gcc: -CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g +CFLAGS = -MD -fshort-wchar -fno-strict-aliasing +-Wno-deprecated-declarations -Wno-self-assign -nostdlib -Wall -Werror +-c -g Basically clang does not support -fno-merge-constants, and -Wno-deprecated-declarations -Wno-self-assign are needed to suppress default warning as errors, errors in the code for clang. Thanks, Andrew Fish ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
