From 80daed61a02daea078f75b27f94d83da6b1f53b5 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 26 Jun 2017 15:50:45 +0100 Subject: [PATCH 1/4] fix taking address of std{out,err} for dmd 2.075.0-b1 --- src/dlangui/core/logger.d | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/dlangui/core/logger.d b/src/dlangui/core/logger.d index 5e4c6d64..de05376f 100644 --- a/src/dlangui/core/logger.d +++ b/src/dlangui/core/logger.d @@ -70,8 +70,8 @@ enum LogLevel : int { return std.datetime.Clock.currStdTime / 10000; } -/** - +/** + Logging utilities Setup example: @@ -92,6 +92,14 @@ Log.e("exception while reading file", e); */ +private auto std_io_err_helper(alias v)() +{ + static if (__VERSION__ < 2075) + return &v; + else + return &v(); +} + class Log { static __gshared private LogLevel logLevel = LogLevel.Info; static __gshared private std.stdio.File * logFile = null; @@ -102,25 +110,25 @@ class Log { _mutex = new Mutex(); return _mutex; } - + /// Redirects output to stdout static public void setStdoutLogger() { synchronized(mutex) { - logFile = &stdout; + logFile = std_io_err_helper!stdout; } } /// Redirects output to stderr static public void setStderrLogger() { synchronized(mutex) { - logFile = &stderr; + logFile = std_io_err_helper!stderr; } } /// Redirects output to file static public void setFileLogger(File * file) { synchronized(mutex) { - if (logFile !is null && logFile != &stdout && logFile != &stderr) { + if (logFile !is null && *logFile != stdout && *logFile != stderr) { logFile.close(); destroy(logFile); logFile = null; @@ -323,7 +331,7 @@ class Log { logf(LogLevel.Fatal, args); } } - + version (Android) { static public void setLogTag(const char * tag) { ANDROID_LOG_TAG = tag; @@ -348,4 +356,3 @@ void onResourceDestroyWhileShutdown(string resourceName, string objname = null) /// set to true when exiting main - to detect destructor calls for resources by GC __gshared bool APP_IS_SHUTTING_DOWN = false; - From bfec06917e30e67b69433f6b09c032c71d3f1f2d Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 26 Jun 2017 15:54:27 +0100 Subject: [PATCH 2/4] test different compilers --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a89dda5d..1c85f57a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,13 @@ os: - linux - osx +d: + - dmd + - dmd-beta + - ldc + - ldc-beta + - gdc + env: - ARCH=x86_64 CONFIG=default - ARCH=x86_64 CONFIG=minimal @@ -11,7 +18,7 @@ env: - ARCH=x86 CONFIG=default - ARCH=x86 CONFIG=minimal - ARCH=x86 CONFIG=x11 - + # No-one cares about OS X x86 and X11 on OSX matrix: exclude: From a85cfe7c69cebd7b9b93bc450a05b350966c55ba Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 26 Jun 2017 16:10:59 +0100 Subject: [PATCH 3/4] select more recent gdc --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1c85f57a..388ebc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ d: - dmd-beta - ldc - ldc-beta - - gdc + - gdc-6.3.0 env: - ARCH=x86_64 CONFIG=default From e1fc92d06676a8414f3b6627e1a9e22e997a04d8 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 26 Jun 2017 16:11:54 +0100 Subject: [PATCH 4/4] exclude osx gdc --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 388ebc84..21aca54d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,8 @@ matrix: env: ARCH=x86 CONFIG=x11 - os: osx env: ARCH=x86_64 CONFIG=x11 + - os: osx + d: gdc-6.3.0 sudo: true before_script: