diff --git a/Src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs b/Src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs index 74456f4dd7d2dde2a8a7252b6b6a8100e22ebb50..46efd257e709b186bab6302aa3bbcc9830b347cb 100644 --- a/Src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs +++ b/Src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs @@ -32,6 +32,10 @@ internal override ImmutableArray GetSupportedErrorCodes() case InternalErrorCode.Unknown: continue; + case (int)ErrorCode.WRN_ALinkWarn: + // We don't support configuring WRN_ALinkWarn. See comments in method "CSharpDiagnosticFilter.Filter" for more details. + continue; + default: builder.Add(errorCode); break; diff --git a/Src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/Src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index e7614ee7fc5b782c6dbce42a605efd7436e425bd..1e740eeb258f495fdba60c727f424660d6221f49 100644 --- a/Src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/Src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -172,7 +172,7 @@ internal enum ErrorCode ERR_TooManyLocals = 204, ERR_AbstractBaseCall = 205, ERR_RefProperty = 206, - WRN_OldWarning_UnsafeProp = 207, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:207" is specified on the command line. + // WRN_OldWarning_UnsafeProp = 207, // This error code is unused. ERR_ManagedAddr = 208, ERR_BadFixedInitType = 209, ERR_FixedMustInit = 210, @@ -273,13 +273,13 @@ internal enum ErrorCode ERR_AbstractSealedStatic = 418, WRN_AmbiguousXMLReference = 419, WRN_VolatileByRef = 420, - WRN_IncrSwitchObsolete = 422, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn" is specified on the command line. + // WRN_IncrSwitchObsolete = 422, // This error code is unused. ERR_ComImportWithImpl = 423, ERR_ComImportWithBase = 424, ERR_ImplBadConstraints = 425, ERR_DottedTypeNameNotFoundInAgg = 426, ERR_MethGrpToNonDel = 428, - WRN_UnreachableExpr = 429, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn" is specified on the command line. + // WRN_UnreachableExpr = 429, // This error code is unused. ERR_BadExternAlias = 430, ERR_ColColWithTypeAlias = 431, ERR_AliasNotFound = 432, @@ -294,7 +294,7 @@ internal enum ErrorCode ERR_SealedStaticClass = 441, ERR_PrivateAbstractAccessor = 442, ERR_ValueExpected = 443, - WRN_UnexpectedPredefTypeLoc = 444, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn" is specified on the command line. + // WRN_UnexpectedPredefTypeLoc = 444, // This error code is unused. ERR_UnboxNotLValue = 445, ERR_AnonMethGrpInForEach = 446, //ERR_AttrOnTypeArg = 447, unused in Roslyn. The scenario for which this error exists should, and does generate a parse error. @@ -407,7 +407,7 @@ internal enum ErrorCode ERR_ComImportWithoutUuidAttribute = 596, ERR_InvalidNamedArgument = 599, ERR_DllImportOnInvalidMethod = 601, - WRN_FeatureDeprecated = 602, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:602" is specified on the command line. + // WRN_FeatureDeprecated = 602, // This error code is unused. // ERR_NameAttributeOnOverride = 609, // removed in Roslyn ERR_FieldCantBeRefAny = 610, ERR_ArrayElementCantBeRefAny = 611, @@ -463,8 +463,8 @@ internal enum ErrorCode WRN_BitwiseOrSignExtend = 675, ERR_VolatileStruct = 677, ERR_VolatileAndReadonly = 678, - WRN_OldWarning_ProtectedInternal = 679, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:679" is specified on the command line. - WRN_OldWarning_AccessibleReadonly = 680, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:680" is specified on the command line. + // WRN_OldWarning_ProtectedInternal = 679, // This error code is unused. + // WRN_OldWarning_AccessibleReadonly = 680, // This error code is unused. ERR_AbstractField = 681, ERR_BogusExplicitImpl = 682, ERR_ExplicitMethodImplAccessor = 683, @@ -632,7 +632,7 @@ internal enum ErrorCode ERR_ProtectedInStatic = 1057, WRN_UnreachableGeneralCatch = 1058, ERR_IncrementLvalueExpected = 1059, - WRN_UninitializedField = 1060, //unused in Roslyn but preserving for the purposes of not breaking users' /nowarn settings + // WRN_UninitializedField = 1060, // unused in Roslyn. ERR_NoSuchMemberOrExtension = 1061, WRN_DeprecatedCollectionInitAddStr = 1062, ERR_DeprecatedCollectionInitAddStr = 1063, @@ -663,12 +663,12 @@ internal enum ErrorCode ERR_ExplicitExtension = 1112, ERR_ValueTypeExtDelegate = 1113, // unused 1114-1199 - // Below five error codes are unused, but we still need to retain them to suppress CS1691 when "/nowarn:1200,1201,1202,1203,1204" is specified on the command line. - WRN_FeatureDeprecated2 = 1200, - WRN_FeatureDeprecated3 = 1201, - WRN_FeatureDeprecated4 = 1202, - WRN_FeatureDeprecated5 = 1203, - WRN_OldWarning_FeatureDefaultDeprecated = 1204, + // Below five error codes are unused. + // WRN_FeatureDeprecated2 = 1200, + // WRN_FeatureDeprecated3 = 1201, + // WRN_FeatureDeprecated4 = 1202, + // WRN_FeatureDeprecated5 = 1203, + // WRN_OldWarning_FeatureDefaultDeprecated = 1204, // unused 1205-1500 ERR_BadArgCount = 1501, //ERR_BadArgTypes = 1502, @@ -751,20 +751,20 @@ internal enum ErrorCode WRN_XMLParseIncludeError = 1592, ERR_BadDelArgCount = 1593, //ERR_BadDelArgTypes = 1594, - WRN_OldWarning_MultipleTypeDefs = 1595, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1595" is specified on the command line. - WRN_OldWarning_DocFileGenAndIncr = 1596, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1596" is specified on the command line. + // WRN_OldWarning_MultipleTypeDefs = 1595, // This error code is unused. + // WRN_OldWarning_DocFileGenAndIncr = 1596, // This error code is unused. ERR_UnexpectedSemicolon = 1597, - WRN_XMLParserNotFound = 1598, // No longer used (though, conceivably, we could report it if Linq to Xml is missing at compile time). + // WRN_XMLParserNotFound = 1598, // No longer used (though, conceivably, we could report it if Linq to Xml is missing at compile time). ERR_MethodReturnCantBeRefAny = 1599, ERR_CompileCancelled = 1600, ERR_MethodArgCantBeRefAny = 1601, ERR_AssgReadonlyLocal = 1604, ERR_RefReadonlyLocal = 1605, //ERR_ALinkCloseFailed = 1606, - WRN_ALinkWarn = 1607, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1607" is specified on the command line. + WRN_ALinkWarn = 1607, ERR_CantUseRequiredAttribute = 1608, ERR_NoModifiersOnAccessor = 1609, - WRN_DeleteAutoResFailed = 1610, // Unused but preserving for /nowarn + // WRN_DeleteAutoResFailed = 1610, // Unused. ERR_ParamsCantBeRefOut = 1611, ERR_ReturnNotLValue = 1612, ERR_MissingCoClass = 1613, @@ -811,7 +811,7 @@ internal enum ErrorCode ERR_AssgReadonlyLocalCause = 1656, ERR_RefReadonlyLocalCause = 1657, WRN_ErrorOverride = 1658, - WRN_OldWarning_ReservedIdentifier = 1659, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1659" is specified on the command line. + // WRN_OldWarning_ReservedIdentifier = 1659, // This error code is unused. ERR_AnonMethToNonDel = 1660, ERR_CantConvAnonMethParams = 1661, ERR_CantConvAnonMethReturns = 1662, @@ -834,33 +834,32 @@ internal enum ErrorCode ERR_BadExternIdentifier = 1679, ERR_AliasMissingFile = 1680, ERR_GlobalExternAlias = 1681, - WRN_MissingTypeNested = 1682, //unused in Roslyn. - // 1683 and 1684 are unused warning codes, but we still need to retain them to suppress CS1691 when "/nowarn:1683" is specified on the command line. + // WRN_MissingTypeNested = 1682, // unused in Roslyn. // In Roslyn, we generate errors ERR_MissingTypeInSource and ERR_MissingTypeInAssembly instead of warnings WRN_MissingTypeInSource and WRN_MissingTypeInAssembly respectively. - WRN_MissingTypeInSource = 1683, - WRN_MissingTypeInAssembly = 1684, + // WRN_MissingTypeInSource = 1683, + // WRN_MissingTypeInAssembly = 1684, WRN_MultiplePredefTypes = 1685, ERR_LocalCantBeFixedAndHoisted = 1686, WRN_TooManyLinesForDebugger = 1687, ERR_CantConvAnonMethNoParams = 1688, ERR_ConditionalOnNonAttributeClass = 1689, WRN_CallOnNonAgileField = 1690, - WRN_BadWarningNumber = 1691, + // WRN_BadWarningNumber = 1691, // we no longer generate this warning for an unrecognized warning ID specified as an argument to /nowarn or /warnasserror. WRN_InvalidNumber = 1692, - WRN_FileNameTooLong = 1694, //unused but preserving for the sake of existing code using /nowarn:1694 + // WRN_FileNameTooLong = 1694, //unused. WRN_IllegalPPChecksum = 1695, WRN_EndOfPPLineExpected = 1696, WRN_ConflictingChecksum = 1697, WRN_AssumedMatchThis = 1698, - WRN_UseSwitchInsteadOfAttribute = 1699, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1699" is specified. - WRN_InvalidAssemblyName = 1700, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1700" is specified. + // WRN_UseSwitchInsteadOfAttribute = 1699, // This error code is unused. + WRN_InvalidAssemblyName = 1700, WRN_UnifyReferenceMajMin = 1701, WRN_UnifyReferenceBldRev = 1702, ERR_DuplicateImport = 1703, ERR_DuplicateImportSimple = 1704, ERR_AssemblyMatchBadVersion = 1705, //ERR_AnonMethNotAllowed = 1706, Unused in Roslyn. Previously given when a lambda was supplied as an attribute argument. - WRN_DelegateNewMethBind = 1707, // This error code is unused, but we still need to retain it to suppress CS1691 when "/nowarn:1707" is specified. + // WRN_DelegateNewMethBind = 1707, // This error code is unused. ERR_FixedNeedsLvalue = 1708, WRN_EmptyFileName = 1709, WRN_DuplicateTypeParamTag = 1710, @@ -1027,7 +1026,7 @@ internal enum ErrorCode ERR_OpenResponseFile = 2011, ERR_CantOpenFileWrite = 2012, ERR_BadBaseNumber = 2013, - WRN_UseNewSwitch = 2014, //unused but preserved to keep compat with /nowarn:2014 + // WRN_UseNewSwitch = 2014, //unused. ERR_BinaryFile = 2015, FTL_BadCodepage = 2016, ERR_NoMainOnDLL = 2017, @@ -1060,7 +1059,7 @@ internal enum ErrorCode WRN_CLS_BadArgType = 3001, // Requires SymbolDistinguisher. WRN_CLS_BadReturnType = 3002, WRN_CLS_BadFieldPropType = 3003, - WRN_CLS_BadUnicode = 3004, //unused but preserved to keep compat with /nowarn:3004 + // WRN_CLS_BadUnicode = 3004, //unused WRN_CLS_BadIdentifierCase = 3005, WRN_CLS_OverloadRefOut = 3006, WRN_CLS_OverloadUnnamed = 3007, diff --git a/Src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs b/Src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs index e4a48ef97c4fdee39df9e853c4da46f582dac8b9..593049d890c694afcad4e6d4988d4049e8788e93 100644 --- a/Src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs +++ b/Src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs @@ -147,26 +147,14 @@ internal static int GetWarningLevel(ErrorCode code) switch (code) { - case ErrorCode.WRN_OldWarning_AccessibleReadonly: - case ErrorCode.WRN_OldWarning_DocFileGenAndIncr: - case ErrorCode.WRN_OldWarning_FeatureDefaultDeprecated: - case ErrorCode.WRN_OldWarning_MultipleTypeDefs: - case ErrorCode.WRN_OldWarning_ProtectedInternal: - case ErrorCode.WRN_OldWarning_ReservedIdentifier: - case ErrorCode.WRN_OldWarning_UnsafeProp: - // Some old warnings which are unused, but we still need to retain them to suppress CS1691 when "/nowarn:code" is specified on the command line. - return 4; case ErrorCode.WRN_InvalidMainSig: case ErrorCode.WRN_LowercaseEllSuffix: case ErrorCode.WRN_NewNotRequired: case ErrorCode.WRN_MainCantBeGeneric: - case ErrorCode.WRN_IncrSwitchObsolete: - case ErrorCode.WRN_UnreachableExpr: case ErrorCode.WRN_ProtectedInSealed: case ErrorCode.WRN_UnassignedInternalField: case ErrorCode.WRN_MissingParamTag: case ErrorCode.WRN_MissingXMLComment: - case ErrorCode.WRN_DeleteAutoResFailed: case ErrorCode.WRN_MissingTypeParamTag: case ErrorCode.WRN_InvalidVersionFormat: return 4; @@ -207,7 +195,6 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_SameFullNameThisAggAgg: case ErrorCode.WRN_SameFullNameThisAggNs: case ErrorCode.WRN_GlobalAliasDefn: - case ErrorCode.WRN_UnexpectedPredefTypeLoc: case ErrorCode.WRN_AlwaysNull: case ErrorCode.WRN_CmpAlwaysFalse: case ErrorCode.WRN_AmbigLookupMeth: @@ -244,7 +231,6 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_ByRefNonAgileField: case ErrorCode.WRN_VolatileByRef: case ErrorCode.WRN_FinalizeMethod: - case ErrorCode.WRN_FeatureDeprecated: case ErrorCode.WRN_DeprecatedSymbol: case ErrorCode.WRN_ExternMethodNoImplementation: case ErrorCode.WRN_AttributeLocationOnBadDeclaration: @@ -255,12 +241,7 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_ExternCtorNoImplementation: case ErrorCode.WRN_WarningDirective: case ErrorCode.WRN_UnreachableGeneralCatch: - case ErrorCode.WRN_UninitializedField: case ErrorCode.WRN_DefaultValueForUnconsumedLocation: - case ErrorCode.WRN_FeatureDeprecated2: - case ErrorCode.WRN_FeatureDeprecated3: - case ErrorCode.WRN_FeatureDeprecated4: - case ErrorCode.WRN_FeatureDeprecated5: case ErrorCode.WRN_EmptySwitch: case ErrorCode.WRN_XMLParseError: case ErrorCode.WRN_BadXMLRef: @@ -270,7 +251,6 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_FailedInclude: case ErrorCode.WRN_InvalidInclude: case ErrorCode.WRN_XMLParseIncludeError: - case ErrorCode.WRN_XMLParserNotFound: case ErrorCode.WRN_ALinkWarn: case ErrorCode.WRN_AssemblyAttributeFromModuleIsOverridden: case ErrorCode.WRN_CmdOptionConflictsSource: @@ -279,20 +259,13 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_BadRestoreNumber: case ErrorCode.WRN_NonECMAFeature: case ErrorCode.WRN_ErrorOverride: - case ErrorCode.WRN_MissingTypeNested: - case ErrorCode.WRN_MissingTypeInSource: - case ErrorCode.WRN_MissingTypeInAssembly: case ErrorCode.WRN_MultiplePredefTypes: case ErrorCode.WRN_TooManyLinesForDebugger: case ErrorCode.WRN_CallOnNonAgileField: - case ErrorCode.WRN_BadWarningNumber: case ErrorCode.WRN_InvalidNumber: - case ErrorCode.WRN_FileNameTooLong: case ErrorCode.WRN_IllegalPPChecksum: case ErrorCode.WRN_EndOfPPLineExpected: case ErrorCode.WRN_ConflictingChecksum: - case ErrorCode.WRN_UseSwitchInsteadOfAttribute: - case ErrorCode.WRN_DelegateNewMethBind: case ErrorCode.WRN_EmptyFileName: case ErrorCode.WRN_DotOnDefault: case ErrorCode.WRN_BadXMLRefTypeVar: @@ -301,7 +274,6 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_MultipleRuntimeImplementationMatches: case ErrorCode.WRN_MultipleRuntimeOverrideMatches: case ErrorCode.WRN_FileAlreadyIncluded: - case ErrorCode.WRN_UseNewSwitch: case ErrorCode.WRN_NoConfigNotOnCommandLine: case ErrorCode.WRN_AnalyzerCannotBeCreated: case ErrorCode.WRN_NoAnalyzerInAssembly: @@ -311,7 +283,6 @@ internal static int GetWarningLevel(ErrorCode code) case ErrorCode.WRN_CLS_BadArgType: case ErrorCode.WRN_CLS_BadReturnType: case ErrorCode.WRN_CLS_BadFieldPropType: - case ErrorCode.WRN_CLS_BadUnicode: case ErrorCode.WRN_CLS_BadIdentifierCase: case ErrorCode.WRN_CLS_OverloadRefOut: case ErrorCode.WRN_CLS_OverloadUnnamed: diff --git a/Src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/Src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs index 04926c87080cebf2627da57efd7d020ef3ff92cb..fe25d80b30214226f18680c148b507275384aff7 100644 --- a/Src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs +++ b/Src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs @@ -5946,12 +5946,9 @@ private static string ComputeSourceText(int startErrorCode, int endErrorCode) for (int errorCode = startErrorCode; errorCode < endErrorCode; errorCode++) { - if (errorCode != (int)ErrorCode.WRN_BadWarningNumber) - { - string pragmaDisableStr = @"#pragma warning disable " + errorCode.ToString() + @" + string pragmaDisableStr = @"#pragma warning disable " + errorCode.ToString() + @" "; - pragmaDisableWarnings += pragmaDisableStr; - } + pragmaDisableWarnings += pragmaDisableStr; } return pragmaDisableWarnings + @" diff --git a/Src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/Src/Compilers/VisualBasic/Portable/Errors/Errors.vb index 7d1eb9e47dd1a80e7100ea0604bf6ab5849ae059..ccf6d4f69fdcb954581b9baee9325dbd3263f3c0 100644 --- a/Src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/Src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -33,7 +33,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ERR_None = 0 ' ERR_InitError = 2000 unused in Roslyn ERR_FileNotFound = 2001 - WRN_FileAlreadyIncluded = 2002 'unused in Roslyn but kept around to preserve legacy nowarn behavior + ' WRN_FileAlreadyIncluded = 2002 'unused in Roslyn. 'ERR_DuplicateResponseFile = 2003 unused in Roslyn. 'ERR_NoMemory = 2004 ERR_ArgumentRequired = 2006 @@ -51,9 +51,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ERR_IconFileAndWin32ResFile = 2023 'WRN_ReservedReference = 2024 'unissued by native compiler due to bug. WRN_NoConfigInResponseFile = 2025 - WRN_InvalidWarningId = 2026 + ' WRN_InvalidWarningId = 2026 ' unused in Roslyn. 'ERR_WatsonSendNotOptedIn = 2027 - WRN_SwitchNoBool = 2028 'unused in Roslyn but preserved to avoid giving BC2026 when this number is used with /nowarn + ' WRN_SwitchNoBool = 2028 'unused in Roslyn ERR_NoSourcesOut = 2029 ERR_NeedModule = 2030 ERR_InvalidAssemblyName = 2031 @@ -1732,7 +1732,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic WRN_UnimplementedCommandLineSwitch = 40998 - WRN_DuplicateAssemblyAttribute1 = 41000 'unused in Roslyn + ' WRN_DuplicateAssemblyAttribute1 = 41000 'unused in Roslyn WRN_NoNonObsoleteConstructorOnBase3 = 41001 WRN_NoNonObsoleteConstructorOnBase4 = 41002 WRN_RequiredNonObsoleteNewCall3 = 41003 @@ -1794,14 +1794,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic WRN_DefAsgNoRetValPropRef1 = 42107 WRN_DefAsgUseNullRefByRefStr = 42108 WRN_DefAsgUseNullRefStr = 42109 - WRN_FieldInForNotExplicit = 42110 'unused in Roslyn + ' WRN_FieldInForNotExplicit = 42110 'unused in Roslyn WRN_StaticLocalNoInference = 42111 '// AVAILABLE 42112 - 42202 - WRN_SxSHigherIndirectRefEmitted4 = 42203 'unused in Roslyn - WRN_ReferencedAssembliesAmbiguous6 = 42204 'unused in Roslyn - WRN_ReferencedAssembliesAmbiguous4 = 42205 'unused in Roslyn - WRN_MaximumNumberOfWarnings = 42206 'unused in Roslyn + ' WRN_SxSHigherIndirectRefEmitted4 = 42203 'unused in Roslyn + ' WRN_ReferencedAssembliesAmbiguous6 = 42204 'unused in Roslyn + ' WRN_ReferencedAssembliesAmbiguous4 = 42205 'unused in Roslyn + ' WRN_MaximumNumberOfWarnings = 42206 'unused in Roslyn WRN_InvalidAssemblyName = 42207 '// AVAILABLE 42209 - 42299 diff --git a/Src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb b/Src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb index a7b9e50e9079bd5b1c66f458eefd329123091319..8f3c0244a83047526836b97834448dbe3b51ccec 100644 --- a/Src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb +++ b/Src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb @@ -74,10 +74,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim errorId = DirectCast(code, ERRID) If ErrorFacts.IsWarning(errorId) AndAlso code <> ERRID.WRN_BadSwitch AndAlso - code <> ERRID.WRN_FileAlreadyIncluded AndAlso code <> ERRID.WRN_NoConfigInResponseFile AndAlso - code <> ERRID.WRN_InvalidWarningId AndAlso - code <> ERRID.WRN_SwitchNoBool AndAlso code <> ERRID.WRN_IgnoreModuleManifest Then Return 1 ElseIf ErrorFacts.IsInfo(errorId) OrElse ErrorFacts.IsHidden(errorId) diff --git a/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb b/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb index c41a019f90534d78e698aa146c9581b15891e6f9..3b78a9fefb49fc1be9d63f5fe62981657f7ee4be 100644 --- a/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb +++ b/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb @@ -282,32 +282,5 @@ blah Dim dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) errors.Verify(Diagnostic(ERRID.ERR_ProjectCCError1).WithArguments("Identifier expected.", " ^^ 'Blah' ^^ ")) End Sub - - - - Sub AllDev11WarningsAreStillWarnings() - ' the warning numbers have been taken from the Dev11 sources (vb\include\errors.inc) - Dim allDev11Warnings() As Integer = {40000, 40003, 40004, 40005, 40007, 40008, 40009, 40010, 40011, 40012, 40014, 40018, 40019, 40020, 40021, - 40022, 40023, 40024, 40025, 40026, 40027, 40028, 40029, 40030, 40031, 40032, 40033, 40034, 40035, 40038, - 40039, 40040, 40041, 40042, 40043, 40046, 40047, 40048, 40049, 40050, 40051, 40052, 40053, 40054, 40055, - 40056, 40057, 40059, 41000, 41001, 41002, 41003, 41004, 41005, 41007, 41008, 41998, 41999, 42000, 42001, - 42002, 42004, 42014, 42015, 42016, 42017, 42018, 42019, 42020, 42021, 42022, 42024, 42025, 42026, 42029, - 42030, 42031, 42032, 42033, 42034, 42035, 42036, 42037, 42038, 42099, 42101, 42102, 42104, 42105, 42106, - 42107, 42108, 42109, 42110, 42111, 42203, 42204, 42205, 42206, 42300, 42301, 42302, 42303, 42304, 42305, - 42306, 42307, 42308, 42309, 42310, 42311, 42312, 42313, 42314, 42315, 42316, 42317, 42318, 42319, 42320, - 42321, 42322, 42324, 42326, 42327, 42328, 42332, 42333, 42334, 42335, 42336, 42337, 42338, 42339, 42340, - 42341, 42342, 42343, 42344, 42345, 42346, 42347, 42348, 42349, 42350, 42351, 42352, 42353, 42354, 42355} - - ' the command line warnings (vb\language\commandlineerrors.inc) - Dim allDev11CommandLineWarnings() As Integer = {2002, 2007, 2025, 2028, 2034} 'note 2024 was never reachable in the native compiler - - For Each warningNumber In allDev11Warnings - Assert.Equal(DiagnosticSeverity.Warning, Global.Microsoft.CodeAnalysis.VisualBasic.MessageProvider.Instance.GetSeverity(warningNumber)) - Next - - For Each warningNumber In allDev11CommandLineWarnings - Assert.Equal(DiagnosticSeverity.Warning, Global.Microsoft.CodeAnalysis.VisualBasic.MessageProvider.Instance.GetSeverity(warningNumber)) - Next - End Sub End Class End Namespace diff --git a/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb b/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb index 6f754ac0bad249c1b7763ef543c470e33ae7d625..625af8aafc07c81ad6f0a51aa9e519ef03de9d0b 100644 --- a/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb +++ b/Src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb @@ -116,74 +116,6 @@ End Module End Sub - - - Public Sub EnsureLegacyWarningsAreMaintained() - Dim src As String = Temp.CreateFile().WriteAllText( -Public Class C -End Class -.Value).Path - - ' the warning numbers have been taken from the Dev11 sources (vb\include\errors.inc) - Dim allDev11Warnings As Integer() = {40000, 40003, 40004, 40005, 40007, 40008, 40009, 40010, 40011, 40012, 40014, 40018, 40019, 40020, 40021, - 40022, 40023, 40024, 40025, 40026, 40027, 40028, 40029, 40030, 40031, 40032, 40033, 40034, 40035, 40038, - 40039, 40040, 40041, 40042, 40043, 40046, 40047, 40048, 40049, 40050, 40051, 40052, 40053, 40054, 40055, - 40056, 40057, 40059, 41000, 41001, 41002, 41003, 41004, 41005, 41007, 41008, 41998, 41999, 42000, 42001, - 42002, 42004, 42014, 42015, 42016, 42017, 42018, 42019, 42020, 42021, 42022, 42024, 42025, 42026, 42029, - 42030, 42031, 42032, 42033, 42034, 42035, 42036, 42037, 42038, 42099, 42101, 42102, 42104, 42105, 42106, - 42107, 42108, 42109, 42110, 42111, 42203, 42204, 42205, 42206, 42300, 42301, 42302, 42303, 42304, 42305, - 42306, 42307, 42308, 42309, 42310, 42311, 42312, 42313, 42314, 42315, 42316, 42317, 42318, 42319, 42320, - 42321, 42322, 42324, 42326, 42327, 42328, 42332, 42333, 42334, 42335, 42336, 42337, 42338, 42339, 42340, - 42341, 42342, 42343, 42344, 42345, 42346, 42347, 42348, 42349, 42350, 42351, 42352, 42353, 42354, 42355} - - Dim cmd = New MockVisualBasicCompiler(Nothing, _baseDirectory, {"/nologo", "/t:library", "/nowarn:" & String.Join(",", allDev11Warnings), src}) - Dim writer As New StringWriter() - Dim result = cmd.Run(writer, Nothing) - - Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Default) - Assert.Equal(0, writer.ToString.Length) - AssertEx.SetEqual(cmd.Arguments.CompilationOptions.SpecificDiagnosticOptions.Keys, allDev11Warnings.AsEnumerable().Select(Function(err) MessageProvider.Instance.GetIdForErrorCode(err))) - - For Each reportWarningOption In cmd.Arguments.CompilationOptions.SpecificDiagnosticOptions.Values - Assert.Equal(reportWarningOption, ReportDiagnostic.Suppress) - Next - - ' the command line warnings (vb\language\commandlineerrors.inc) - Dim allDev11CommandLineWarnings As Integer() = {2002, 2007, 2024, 2025, 2028, 2034} - - ' Previous versions of the compiler used to report warnings (BC2026) - ' whenever one of the below command line warnings was supplied via /nowarn or /warnaserror. - ' We no longer generate a warning in such cases. - cmd = New MockVisualBasicCompiler(Nothing, _baseDirectory, {"/nologo", "/t:library", "/nowarn:" & String.Join(",", allDev11CommandLineWarnings), src}) - writer = New StringWriter() - result = cmd.Run(writer, Nothing) - - Assert.Equal(String.Empty, writer.ToString.Trim) - - ' Previous versions of the compiler used to report warnings (BC2026) - ' whenever an unrecognized warning code was supplied via /nowarn or /warnaserror. - ' We no longer generate a warning in such cases. - cmd = New MockVisualBasicCompiler(Nothing, _baseDirectory, {"/nologo", "/t:library", "/nowarn:42325", src}) - writer = New StringWriter() - result = cmd.Run(writer, Nothing) - - Assert.Equal(String.Empty, writer.ToString.Trim) - - cmd = New MockVisualBasicCompiler(Nothing, _baseDirectory, {"/nologo", "/t:library", "/nowarn:70000", src}) - writer = New StringWriter() - result = cmd.Run(writer, Nothing) - - Assert.Equal(String.Empty, writer.ToString.Trim) - - cmd = New MockVisualBasicCompiler(Nothing, _baseDirectory, {"/nologo", "/t:library", "/nowarn:abc", src}) - writer = New StringWriter() - result = cmd.Run(writer, Nothing) - - Assert.Equal(String.Empty, writer.ToString.Trim) - - CleanupAllGeneratedFiles(src) - End Sub - Public Sub Bug_722561()