diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-07-02 14:06:15 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-07-03 20:17:45 +0200 |
commit | cd878232b5747e8993bd0bae8c451c5128038130 (patch) | |
tree | 1390f79ee521d140dd42177db864abd83cf4b9a7 /src | |
parent | c07442d8d2df084e7f22ca1c5102858a6aa15807 (diff) | |
download | scala-cd878232b5747e8993bd0bae8c451c5128038130.tar.gz scala-cd878232b5747e8993bd0bae8c451c5128038130.tar.bz2 scala-cd878232b5747e8993bd0bae8c451c5128038130.zip |
Warn when combining settings for the old optimizer with -YGenBCode
Remove some unnecessary flags files
- neg/t4425.flags
- run/blame_eye_triple_eee-double.flags
- run/blame_eye_triple_eee-float.flags
Force tests that use -optimize to GenASM
- neg/sealed-final-neg.flags
- pos/inline-access-levels.flags
- pos/inliner2.flags
- pos/sealed-final.flags
- pos/t3420.flags
- pos/t8410.flags
- run/constant-optimization.flags
- run/dead-code-elimination.flags
- run/elidable-opt.flags
- run/finalvar.flags
- run/icode-reader-dead-code.scala
- run/optimizer-array-load.flags
- run/synchronized.flags
- run/t3509.flags
- run/t3569.flags
- run/t4285.flags
- run/t4935.flags
- run/t5789.scala
- run/t6188.flags
- run/t7459b-optimize.flags
- run/t7582.flags
- run/t7582b.flags
- run/t8601.flags
- run/t8601b.flags
- run/t8601c.flags
- run/t8601d.flags
- run/t8601e.flags
- run/t9003.flags
Move some tests to the new optimizer
- run/classfile-format-51.scala
- run/classfile-format-52.scala
- run/run-bug4840.flags
- run/t2106.flags
- run/t6102.flags
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 965f984367..5cb31c1b64 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -1373,7 +1373,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) unitbuf += unit compiledFiles += unit.source.file.path } - private def checkDeprecatedSettings(unit: CompilationUnit) { + private def warnDeprecatedAndConflictingSettings(unit: CompilationUnit) { // issue warnings for any usage of deprecated settings settings.userSetSettings filter (_.isDeprecated) foreach { s => currentRun.reporting.deprecationWarning(NoPosition, s.name + " is deprecated: " + s.deprecationMessage.get) @@ -1383,6 +1383,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) currentRun.reporting.deprecationWarning(NoPosition, settings.target.name + ":" + settings.target.value + " is deprecated and has no effect, setting to " + supportedTarget) settings.target.value = supportedTarget } + settings.conflictWarning.foreach(reporter.warning(NoPosition, _)) } /* An iterator returning all the units being compiled in this run */ @@ -1473,7 +1474,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def compileSources(sources: List[SourceFile]) = if (!reporter.hasErrors) { def checkDeprecations() = { - checkDeprecatedSettings(newCompilationUnit("")) + warnDeprecatedAndConflictingSettings(newCompilationUnit("")) reporting.summarizeErrors() } @@ -1495,7 +1496,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) val startTime = currentTime reporter.reset() - checkDeprecatedSettings(unitbuf.head) + warnDeprecatedAndConflictingSettings(unitbuf.head) globalPhase = fromPhase while (globalPhase.hasNext && !reporter.hasErrors) { diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index eb4c1aee83..dedf268b56 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -388,6 +388,23 @@ trait ScalaSettings extends AbsScalaSettings val Normal = "normal" val Discard = "discard" } + + def conflictWarning: Option[String] = { + def oldOptimiseFlagsInGenBCode: Option[String] = { + val optFlags: List[Setting] = if (optimise.value) List(optimise) else optimiseSettings.filter(_.value) + if (isBCodeActive && optFlags.nonEmpty) { + val msg = s"""Compiler settings for the 2.11 optimizer (${optFlags.map(_.name).mkString(", ")}) are incompatible with -Ybackend:GenBCode (which is the default in 2.12). + |The optimizer settings are ignored. See -Yopt:help for enabling the new optimizer in 2.12.""".stripMargin + Some(msg) + } else + None + } + + List(oldOptimiseFlagsInGenBCode /*, moreToCome */).flatten match { + case Nil => None + case warnings => Some("Conflicting compiler settings were detected. Some settings will be ignored.\n" + warnings.mkString("\n")) + } + } } object ClassPathRepresentationType { |