BaseTools: Fix build on FreeBSD and allow use of non-gcc system compiler

On FreeBSD, uuid.h is in /usr/include, not /usr/include/uuid.

Fix some errors when building using clang caused by self-assignment: the
preferred way to 'use' a variable is '(void)x;', not 'x = x;'.

Where the system provides $(CC) etc. by default, don't override it to be gcc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bruce Cran <bruce@cran.org.uk>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17866 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Bruce Cran 2015-07-08 01:06:25 +00:00 committed by yingke
parent e109e3fec9
commit 5ddccf34c4
5 changed files with 15 additions and 10 deletions

View File

@ -16,8 +16,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Include files
//
#ifdef __GNUC__
#if defined(__FreeBSD__)
#include <uuid.h>
#elif defined(__GNUC__)
#include <uuid/uuid.h>
#endif
#ifdef __GNUC__
#include <sys/stat.h>
#endif
#include <string.h>

View File

@ -43,8 +43,8 @@ const char *kCantWriteMessage = "Can not write output file";
const char *kCantAllocateMessage = "Can not allocate memory";
const char *kDataErrorMessage = "Data error";
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) { (void)p; return MyAlloc(size); }
static void SzFree(void *p, void *address) { (void)p; MyFree(address); }
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
static Bool mQuietMode = False;

View File

@ -2112,7 +2112,7 @@ void LzmaEnc_Finish(CLzmaEncHandle pp)
if (p->mtMode)
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
#else
pp = pp;
(void)pp;
#endif
}

View File

@ -21,11 +21,11 @@ CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
LINUX:=$(findstring Linux, $(shell uname -s))
DARWIN:=$(findstring Darwin, $(shell uname -s))
CC = gcc
CXX = g++
AS = gcc
AR = ar
LD = ld
CC ?= gcc
CXX ?= g++
AS ?= gcc
AR ?= ar
LD ?= ld
LINKER ?= $(CC)
ifeq ($(ARCH), IA32)
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/

View File

@ -164,7 +164,7 @@ PCCTS_H=../h
#
# UNIX (default)
#
CC=gcc
CC?=gcc
COPT=-O
ANTLR=${BIN_DIR}/antlr
DLG=${BIN_DIR}/dlg