Skip to content
Permalink
Browse files
[Truffle] Hide ignored flags warning.
  • Loading branch information
chrisseaton committed Jan 30, 2015
1 parent 7156dac commit 0a6a2b904cc45c20ecd7fa189e9b3df2ea125b0a
@@ -71,6 +71,7 @@
import org.jruby.util.Sprintf;
import org.jruby.util.StringSupport;
import org.jruby.util.TypeConverter;
import org.jruby.util.cli.Options;
import org.jruby.util.io.EncodingUtils;
import org.jruby.util.collections.WeakValuedMap;

@@ -1248,7 +1249,7 @@ public IRubyObject initialize_m19(IRubyObject arg) {

@JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE)
public IRubyObject initialize_m19(IRubyObject arg0, IRubyObject arg1) {
if (arg0 instanceof RubyRegexp) {
if (arg0 instanceof RubyRegexp && Options.PARSER_WARN_FLAGS_IGNORED.load()) {
getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");
return initializeByRegexp19((RubyRegexp)arg0);
}
@@ -1259,8 +1260,8 @@ public IRubyObject initialize_m19(IRubyObject arg0, IRubyObject arg1) {

@JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE)
public IRubyObject initialize_m19(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
if (arg0 instanceof RubyRegexp) {
getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");
if (arg0 instanceof RubyRegexp && Options.PARSER_WARN_FLAGS_IGNORED.load()) {
getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");
return initializeByRegexp19((RubyRegexp)arg0);
}

@@ -819,7 +819,7 @@ private int hereDocumentIdentifier() throws IOException {
}

private void arg_ambiguous() {
if (warnings.isVerbose() && Options.PARSER_AMBIGUOUS_ARGUMENTS.load()) {
if (warnings.isVerbose() && Options.PARSER_WARN_AMBIGUOUS_ARGUMENTS.load()) {
warnings.warning(ID.AMBIGUOUS_ARGUMENT, getPosition(), "Ambiguous first argument; make sure.");
}
}
@@ -65,7 +65,8 @@ public class Options {
public static final Option<Boolean> PARSER_WARN_LOCAL_SHADOWING = bool(PARSER, "parser.warn.shadowing_local", true, "Warn about shadowing local variables.");
public static final Option<Boolean> PARSER_WARN_REGEX_CONDITION = bool(PARSER, "parser.warn.regex_condition", true, "Warn about regex literals in conditions.");
public static final Option<Boolean> PARSER_WARN_ARGUMENT_PREFIX = bool(PARSER, "parser.warn.argument_prefix", true, "Warn about splat operators being interpreted as argument prefixes.");
public static final Option<Boolean> PARSER_AMBIGUOUS_ARGUMENTS = bool(PARSER, "parser.warn.ambiguous_argument", true, "Warn about ambiguous arguments.");
public static final Option<Boolean> PARSER_WARN_AMBIGUOUS_ARGUMENTS = bool(PARSER, "parser.warn.ambiguous_argument", true, "Warn about ambiguous arguments.");
public static final Option<Boolean> PARSER_WARN_FLAGS_IGNORED = bool(PARSER, "parser.warn.flags_ignored", true, "Warn about ignored regex flags being ignored.");

public static final Option<CompileMode> COMPILE_MODE = enumeration(COMPILER, "compile.mode", CompileMode.class, CompileMode.JIT, "Set compilation mode. JIT = at runtime; FORCE = before execution.");
public static final Option<Boolean> COMPILE_DUMP = bool(COMPILER, "compile.dump", false, "Dump to console all bytecode generated at runtime.");
@@ -10,4 +10,5 @@ bin/jruby -X+T \
-Xparser.warn.regex_condition=false \
-Xparser.warn.argument_prefix=false \
-Xparser.warn.ambiguous_argument=false \
-Xparser.warn.flags_ignored=false \
-J-ea -J-Xmx2G "$@"
@@ -6,4 +6,5 @@
-Xparser.warn.regex_condition=false ^
-Xparser.warn.argument_prefix=false ^
-Xparser.warn.ambiguous_argument=false ^
-Xparser.warn.flags_ignored=false ^
-J-ea -J-Xmx2G %*
@@ -236,6 +236,7 @@
'<arg value="-Xparser.warn.regex_condition=false" />' +
'<arg value="-Xparser.warn.argument_prefix=false" />' +
'<arg value="-Xparser.warn.ambiguous_argument=false" />' +
'<arg value="-Xparser.warn.flags_ignored=false" />' +
'<arg value="-J-ea" />' +
'<arg value="-J-Xmx1G" />' +
'<arg value="spec/mspec/bin/mspec" />' +
@@ -261,6 +262,8 @@
#'<arg value="-T" />' +
#'<arg value="-Xparser.warn.ambiguous_argument=false" />' +
#'<arg value="-T" />' +
#'<arg value="-Xparser.warn.flags_ignored=false" />' +
#'<arg value="-T" />' +
#'<arg value="-J-ea" />' +
'<arg value="--config" />' +
'<arg value="spec/truffle/truffle.mspec" />' +
@@ -290,6 +293,7 @@
'<arg value="-Xparser.warn.regex_condition=false" />' +
'<arg value="-Xparser.warn.argument_prefix=false" />' +
'<arg value="-Xparser.warn.ambiguous_argument=false" />' +
'<arg value="-Xparser.warn.flags_ignored=false" />' +
'<arg value="-J-ea" />' +
'<arg value="-J-Xmx1G" />' +
'<arg value="spec/mspec/bin/mspec" />' +
@@ -315,6 +319,8 @@
#'<arg value="-T" />' +
#'<arg value="-Xparser.warn.ambiguous_argument=false" />' +
#'<arg value="-T" />' +
#'<arg value="-Xparser.warn.flags_ignored=false" />' +
#'<arg value="-T" />' +
#'<arg value="-J-ea" />' +
'<arg value="--config" />' +
'<arg value="spec/truffle/truffle.mspec" />' +
@@ -725,6 +725,7 @@
<arg value="-Xparser.warn.regex_condition=false" />
<arg value="-Xparser.warn.argument_prefix=false" />
<arg value="-Xparser.warn.ambiguous_argument=false" />
<arg value="-Xparser.warn.flags_ignored=false" />
<arg value="-J-ea" />
<arg value="-J-Xmx1G" />
<arg value="spec/mspec/bin/mspec" />
@@ -769,6 +770,7 @@
<arg value="-Xparser.warn.regex_condition=false" />
<arg value="-Xparser.warn.argument_prefix=false" />
<arg value="-Xparser.warn.ambiguous_argument=false" />
<arg value="-Xparser.warn.flags_ignored=false" />
<arg value="-J-ea" />
<arg value="-J-Xmx1G" />
<arg value="spec/mspec/bin/mspec" />
@@ -27,6 +27,7 @@
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
import org.jruby.util.ByteList;
import org.jruby.util.cli.Options;

import static org.jruby.util.StringSupport.CR_7BIT;

@@ -249,7 +250,9 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnin
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnings("unused") Object options) {
notDesignedForCompilation();

getContext().getWarnings().warn("flags ignored");
if (Options.PARSER_WARN_FLAGS_IGNORED.load()) {
getContext().getWarnings().warn("flags ignored");
}

return initialize(regexp, from, UndefinedPlaceholder.INSTANCE);
}

0 comments on commit 0a6a2b9

Please sign in to comment.