macOS build with latest clang from Xcode
A bunch of new warnings appeared by default on macOS compiler provided with Xcode, including on every usage of sprintf(). Suppress those for now. The issues with utilizing WANT_ASAN=1 on the make command line with macOS seem to be resolved in this latest version, so allow it to be specified. Don't specify it if using a problematic clang version.
This commit is contained in:
@@ -60,10 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uudecode [input]
|
||||
*
|
||||
@@ -85,7 +81,9 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "warnings.h"
|
||||
/* #include "warnings.h" */
|
||||
#define DISABLE_WARNING_UNREACHABLE_CODE
|
||||
#define RESTORE_WARNINGS
|
||||
|
||||
static void decode(FILE *, FILE *);
|
||||
static void outdec(char *, FILE *, int);
|
||||
@@ -130,7 +128,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
(void) sscanf(buf, "begin %o %s", &mode, dest);
|
||||
|
||||
#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS)
|
||||
#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(__APPLE__)
|
||||
/* handle ~user/file format */
|
||||
if (dest[0] == '~') {
|
||||
char *sl;
|
||||
@@ -154,7 +152,7 @@ main(int argc, char **argv)
|
||||
strcat(dnbuf, sl);
|
||||
strcpy(dest, dnbuf);
|
||||
}
|
||||
#endif /* !defined(MSDOS) && !defined(VMS) */
|
||||
#endif /* !MSDOS && !VMS && !WIN32 && !__APPLE__ */
|
||||
|
||||
/* create output file */
|
||||
#if defined(MSDOS) || defined(WIN32)
|
||||
@@ -239,7 +237,8 @@ outdec(char *p, FILE *f, int n)
|
||||
putc(c3, f);
|
||||
}
|
||||
|
||||
#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS)
|
||||
#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(__APPLE__)
|
||||
|
||||
/*
|
||||
* Return the ptr in sp at which the character c appears;
|
||||
* NULL if not found
|
||||
|
||||
@@ -29,9 +29,9 @@ CCFLAGS = -g
|
||||
# CPLUSPLUS_NEED_DEPSUPPRESS = 1 C++ -Wno-deprecated-copy,
|
||||
# -Wno-deprecated-declarations
|
||||
|
||||
#ifeq "$(WANT_ASAN)" "1"
|
||||
#NEED_ASAN=1
|
||||
#endif
|
||||
ifeq "$(WANT_ASAN)" "1"
|
||||
USE_ASAN=1
|
||||
endif
|
||||
|
||||
# If you want to override the compiler detection just carried out
|
||||
# uncomment one of the following pairs. Note, however, that
|
||||
@@ -63,10 +63,6 @@ CFLAGS+=-Wmissing-prototypes
|
||||
CFLAGS+=-Wold-style-definition
|
||||
CFLAGS+=-Wstrict-prototypes
|
||||
|
||||
#ifeq "$(NEED_ASAN)" "1"
|
||||
#CFLAGS+=-fsanitize=address
|
||||
#endif
|
||||
|
||||
#detection of clang vs gcc
|
||||
CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
|
||||
ifeq "$(CCISCLANG)" ""
|
||||
@@ -89,6 +85,10 @@ endif # GCC greater than or equal to 9
|
||||
else # gcc or clang?
|
||||
CXX=clang++ -std=gnu++11
|
||||
# clang-specific follows
|
||||
CLANGGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14)
|
||||
ifeq "$(CLANGGTEQ14)" "1"
|
||||
CFLAGS+=-Wno-deprecated-declarations
|
||||
endif
|
||||
# none
|
||||
endif # clang-specific ends here
|
||||
|
||||
@@ -139,6 +139,9 @@ CLANGPPGTEQ14 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 14)
|
||||
ifeq "$(CLANGPPGTEQ9)" "1"
|
||||
#CCXXFLAGS+=-Wformat-overflow
|
||||
endif
|
||||
ifeq "$(CLANGPPGTEQ14)" "1"
|
||||
CPLUSPLUS_NEED_DEPSUPPRESS=1
|
||||
endif
|
||||
ifdef CPLUSPLUS_NEED_DEPSUPPRESS
|
||||
CCXXFLAGS+=-Wno-deprecated
|
||||
CCXXFLAGS+=-Wno-deprecated-declarations
|
||||
|
||||
@@ -56,7 +56,8 @@ endif # WANT_WIN_QT
|
||||
#
|
||||
#-INCLUDE multiw-3.370
|
||||
|
||||
ifeq "$(NEED_ASAN)" "1"
|
||||
ifeq "$(USE_ASAN)" "1"
|
||||
CFLAGS+=-fsanitize=address
|
||||
LFLAGS+=-fsanitize=address
|
||||
endif
|
||||
|
||||
|
||||
@@ -72,10 +72,9 @@ endif # WANT_WIN_QT
|
||||
|
||||
#-INCLUDE multiw-3.370
|
||||
|
||||
ifdef NEED_ASAN
|
||||
ifeq "$(NEED_ASAN)" "1"
|
||||
#LFLAGS +=-fsanitize=address
|
||||
endif
|
||||
ifeq "$(USE_ASAN)" "1"
|
||||
CFLAGS +=-fsanitize=address
|
||||
LFLAGS +=-fsanitize=address
|
||||
endif
|
||||
|
||||
# NetHack sources control
|
||||
|
||||
Reference in New Issue
Block a user