Merge branch 'crashlog_improvements' into jgrpp

This commit is contained in:
Jonathan G Rennison
2016-09-08 19:41:53 +01:00
3 changed files with 16 additions and 11 deletions

View File

@@ -1589,8 +1589,11 @@ make_cflags_and_ldflags() {
cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null` cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null`
if [ -n "$cc_build_is_gcc" ]; then if [ -n "$cc_build_is_gcc" ]; then
# Just add -O1 to the tools needed for building. # Add -O1 and fortify source to the tools needed for building, on gcc
CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1" CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
elif [ -n "`basename "$cc_build" | grep "clang" 2>/dev/null`" ]; then
# Add -O1 to the tools needed for building, on clang
CFLAGS_BUILD="$CFLAGS_BUILD -O1"
fi fi
fi fi
@@ -1729,9 +1732,13 @@ EOL
if [ -n "$LIBBFD_LIBS" -o -n "$HAVE_GDB_DBG" ]; then if [ -n "$LIBBFD_LIBS" -o -n "$HAVE_GDB_DBG" ]; then
if [ $enable_debug -lt 1 ] && [ "$with_bfd_extra_debug" = "1" ]; then if [ $enable_debug -lt 1 ] && [ "$with_bfd_extra_debug" = "1" ]; then
if [ -n "`basename "$cc_host" | grep "clang" 2>/dev/null`" ]; then
CFLAGS="$CFLAGS -gline-tables-only"
else
CFLAGS="$CFLAGS -g1" CFLAGS="$CFLAGS -g1"
fi fi
fi fi
fi
log 2 "executing $cc_host $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.sigaction -x c++ - -ldl" log 2 "executing $cc_host $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.sigaction -x c++ - -ldl"
"$cc_host" $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.sigaction -x c++ - -ldl 2> /dev/null << EOL "$cc_host" $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.sigaction -x c++ - -ldl 2> /dev/null << EOL

View File

@@ -82,6 +82,8 @@ char *CrashLog::LogCompiler(char *buffer, const char *last) const
buffer += seprintf(buffer, last, " Compiler: " buffer += seprintf(buffer, last, " Compiler: "
#if defined(_MSC_VER) #if defined(_MSC_VER)
"MSVC %d", _MSC_VER "MSVC %d", _MSC_VER
#elif defined(__clang__)
"clang %s", __clang_version__
#elif defined(__ICC) && defined(__GNUC__) #elif defined(__ICC) && defined(__GNUC__)
"ICC %d (GCC %d.%d.%d mode)", __ICC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ "ICC %d (GCC %d.%d.%d mode)", __ICC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
#elif defined(__ICC) #elif defined(__ICC)

View File

@@ -143,7 +143,7 @@
#endif /* PSP */ #endif /* PSP */
/* Stuff for GCC */ /* Stuff for GCC */
#if defined(__GNUC__) #if defined(__GNUC__) || defined(__clang__)
#define NORETURN __attribute__ ((noreturn)) #define NORETURN __attribute__ ((noreturn))
#define CDECL #define CDECL
#define __int64 long long #define __int64 long long
@@ -151,12 +151,8 @@
/* Warn about functions using 'printf' format syntax. First argument determines which parameter /* Warn about functions using 'printf' format syntax. First argument determines which parameter
* is the format string, second argument is start of values passed to printf. */ * is the format string, second argument is start of values passed to printf. */
#define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args))) #define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args)))
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#define FINAL final #define FINAL final
#else #endif /* __GNUC__ || __clang__ */
#define FINAL
#endif
#endif /* __GNUC__ */
#if defined(__WATCOMC__) #if defined(__WATCOMC__)
#define NORETURN #define NORETURN
@@ -431,13 +427,13 @@ assert_compile(SIZE_MAX >= UINT32_MAX);
#define CloseConnection OTTD_CloseConnection #define CloseConnection OTTD_CloseConnection
#endif /* __APPLE__ */ #endif /* __APPLE__ */
#ifdef __GNUC__ #if defined(__GNUC__) || defined(__clang__)
#define likely(x) __builtin_expect(!!(x), 1) #define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0) #define unlikely(x) __builtin_expect(!!(x), 0)
#else #else
#define likely(x) (x) #define likely(x) (x)
#define unlikely(x) (x) #define unlikely(x) (x)
#endif #endif /* __GNUC__ || __clang__ */
void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2); void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2);
void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2); void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);