From 1bedba3176ab09101ded195d35ae818c4a1842be Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 31 Mar 2017 11:45:17 -0700 Subject: [PATCH] Fix build breaks Commit migrated from https://github.com/dotnet/coreclr/commit/9b1504c1baccdebe5e3df9dba3d8faaf548a4b2e --- src/coreclr/src/mscorlib/Resources/Strings.resx | 11 +++- .../src/mscorlib/System.Private.CoreLib.csproj | 8 +-- src/coreclr/src/mscorlib/src/Debug.cs | 29 ----------- .../Interop.Collation.cs | 1 + .../Interop/Unix/System.Native/Interop.SysLog.cs | 58 ++++++++++++++++++++++ .../src/mscorlib/src/System/ArraySegment.cs | 1 + .../mscorlib/src/System/Diagnostics/Debug.Unix.cs | 37 +++++++------- .../System/Globalization/CalendarData.Windows.cs | 1 + .../src/System/Globalization/CultureInfo.Unix.cs | 1 + .../System/Globalization/CultureInfo.Windows.cs | 2 + .../src/System/Globalization/IdnMapping.Unix.cs | 2 + .../src/System/Globalization/IdnMapping.cs | 1 + .../System/Globalization/JapaneseCalendar.Unix.cs | 1 + .../src/System/Reflection/LocalVariableInfo.cs | 2 + .../src/System/Reflection/RuntimeEventInfo.cs | 1 + .../src/System/Reflection/RuntimeParameterInfo.cs | 1 + .../CompilerServices/ConditionalWeakTable.cs | 1 + src/coreclr/src/mscorlib/src/System/ThrowHelper.cs | 1 + src/coreclr/src/mscorlib/src/System/TimeZone.cs | 1 + .../src/mscorlib/src/System/TimeZoneInfo.Win32.cs | 1 + .../src/mscorlib/src/System/TimeZoneInfo.cs | 1 + 21 files changed, 109 insertions(+), 53 deletions(-) delete mode 100644 src/coreclr/src/mscorlib/src/Debug.cs create mode 100644 src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs diff --git a/src/coreclr/src/mscorlib/Resources/Strings.resx b/src/coreclr/src/mscorlib/Resources/Strings.resx index 9769d5e..0ff4814 100644 --- a/src/coreclr/src/mscorlib/Resources/Strings.resx +++ b/src/coreclr/src/mscorlib/Resources/Strings.resx @@ -3557,4 +3557,13 @@ at - + + ---- DEBUG ASSERTION FAILED ---- + + + ---- Assert Long Message ---- + + + ---- Assert Short Message ---- + + diff --git a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj index 6f18a4f..3b6bfb6 100644 --- a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj @@ -712,6 +712,10 @@ + + + + @@ -913,9 +917,7 @@ - - - + diff --git a/src/coreclr/src/mscorlib/src/Debug.cs b/src/coreclr/src/mscorlib/src/Debug.cs deleted file mode 100644 index 35cb680..0000000 --- a/src/coreclr/src/mscorlib/src/Debug.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System -{ - internal static class Debug - { - [Conditional("_DEBUG")] - static public void Assert(bool condition) - { - BCLDebug.Assert(condition); - } - - [Conditional("_DEBUG")] - static public void Assert(bool condition, string message) - { - BCLDebug.Assert(condition, message); - } - - [Conditional("_DEBUG")] - static public void Fail(string message) - { - BCLDebug.Assert(false, message); - } - } -} diff --git a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs index 5cd2ee5..fe14560 100644 --- a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs +++ b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security; diff --git a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs new file mode 100644 index 0000000..6b6a74b --- /dev/null +++ b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Sys + { + internal enum SysLogPriority : int + { + // Priorities + LOG_EMERG = 0, /* system is unusable */ + LOG_ALERT = 1, /* action must be taken immediately */ + LOG_CRIT = 2, /* critical conditions */ + LOG_ERR = 3, /* error conditions */ + LOG_WARNING = 4, /* warning conditions */ + LOG_NOTICE = 5, /* normal but significant condition */ + LOG_INFO = 6, /* informational */ + LOG_DEBUG = 7, /* debug-level messages */ + // Facilities + LOG_KERN = (0<<3), /* kernel messages */ + LOG_USER = (1<<3), /* random user-level messages */ + LOG_MAIL = (2<<3), /* mail system */ + LOG_DAEMON = (3<<3), /* system daemons */ + LOG_AUTH = (4<<3), /* authorization messages */ + LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ + LOG_LPR = (6<<3), /* line printer subsystem */ + LOG_NEWS = (7<<3), /* network news subsystem */ + LOG_UUCP = (8<<3), /* UUCP subsystem */ + LOG_CRON = (9<<3), /* clock daemon */ + LOG_AUTHPRIV = (10<<3), /* authorization messages (private) */ + LOG_FTP = (11<<3), /* ftp daemon */ + // Between FTP and Local is reserved for system use + LOG_LOCAL0 = (16<<3), /* reserved for local use */ + LOG_LOCAL1 = (17<<3), /* reserved for local use */ + LOG_LOCAL2 = (18<<3), /* reserved for local use */ + LOG_LOCAL3 = (19<<3), /* reserved for local use */ + LOG_LOCAL4 = (20<<3), /* reserved for local use */ + LOG_LOCAL5 = (21<<3), /* reserved for local use */ + LOG_LOCAL6 = (22<<3), /* reserved for local use */ + LOG_LOCAL7 = (23<<3), /* reserved for local use */ + } + + /// + /// Write a message to the system logger, which in turn writes the message to the system console, log files, etc. + /// See man 3 syslog for more info + /// + /// + /// The OR of a priority and facility in the SysLogPriority enum to declare the priority and facility of the log entry + /// + /// The message to put in the log entry + /// Like printf, the argument is passed to the variadic part of the C++ function to wildcards in the message + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog")] + internal static extern void SysLog(SysLogPriority priority, string message, string arg1); + } +} diff --git a/src/coreclr/src/mscorlib/src/System/ArraySegment.cs b/src/coreclr/src/mscorlib/src/System/ArraySegment.cs index 1e127e3..e0118c2 100644 --- a/src/coreclr/src/mscorlib/src/System/ArraySegment.cs +++ b/src/coreclr/src/mscorlib/src/System/ArraySegment.cs @@ -15,6 +15,7 @@ using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.Contracts; namespace System diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs index 6c9ec04..9584d75 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs @@ -84,33 +84,30 @@ namespace System.Diagnostics int bufCount; int i = 0; - using (SafeFileHandle fileHandle = SafeFileHandleHelper.Open(() => Interop.Sys.Dup(Interop.Sys.FileDescriptors.STDERR_FILENO))) + while (i < message.Length) { - while (i < message.Length) + for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++) { - for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++) + if (message[i] <= 0x7F) { - if (message[i] <= 0x7F) - { - buf[bufCount] = (byte)message[i]; - bufCount++; - } + buf[bufCount] = (byte)message[i]; + bufCount++; } + } - int totalBytesWritten = 0; - while (bufCount > 0) + int totalBytesWritten = 0; + while (bufCount > 0) + { + int bytesWritten = Interop.Sys.Write(2 /* stderr */, buf + totalBytesWritten, bufCount); + if (bytesWritten < 0) { - int bytesWritten = Interop.Sys.Write(fileHandle, buf + totalBytesWritten, bufCount); - if (bytesWritten < 0) - { - // On error, simply stop writing the debug output. This could commonly happen if stderr - // was piped to a program that ended before this program did, resulting in EPIPE errors. - return; - } - - bufCount -= bytesWritten; - totalBytesWritten += bytesWritten; + // On error, simply stop writing the debug output. This could commonly happen if stderr + // was piped to a program that ended before this program did, resulting in EPIPE errors. + return; } + + bufCount -= bytesWritten; + totalBytesWritten += bytesWritten; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs index 206d077..51a2727 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Diagnostics.Contracts; diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs index 4d98dd6..7a8a9fd 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; using System.Threading; namespace System.Globalization diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs index 827330b..e33874e 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; + #if ENABLE_WINRT using Internal.Runtime.Augments; #endif diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs index aab957a..f1ad6f1 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; + namespace System.Globalization { sealed partial class IdnMapping diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs index 1f6bd9b..4320e3a 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs @@ -24,6 +24,7 @@ // RFC 3491 - Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN) // RFC 3492 - Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA) +using System.Diagnostics; using System.Diagnostics.Contracts; using System.Text; diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs b/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs index 6f8e0ba..51ff809 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; namespace System.Globalization { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs index 41d7477..241a3c4 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; + namespace System.Reflection { public class LocalVariableInfo diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs index e2faf83..930e182 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.Contracts; using System.Runtime.Serialization; using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs index 77a56b4..a8d6240 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.Contracts; using System.Runtime.Serialization; using System.Runtime.CompilerServices; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs index 9e4673b..f32cc2b 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs @@ -61,6 +61,7 @@ using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; diff --git a/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs b/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs index 445ea31..4dcf8d4 100644 --- a/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs @@ -38,6 +38,7 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Runtime.Serialization; +using System.Diagnostics; using System.Diagnostics.Contracts; namespace System diff --git a/src/coreclr/src/mscorlib/src/System/TimeZone.cs b/src/coreclr/src/mscorlib/src/System/TimeZone.cs index 88e2e21..00883b3 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZone.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZone.cs @@ -22,6 +22,7 @@ using System; using System.Text; using System.Threading; using System.Collections; +using System.Diagnostics; using System.Globalization; namespace System diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs index 5107fee..f359a2a 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Security; diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs index 3dd0aec..29ea33a 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Diagnostics.Contracts; using System.Globalization; using System.Runtime.Serialization; -- 2.7.4