summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMitchell Blank Jr <[email protected]>2012-05-20 00:26:49 -0700
committerMitchell Blank Jr <[email protected]>2012-05-20 00:26:49 -0700
commit606a1665c5cfff42622687d693b9362b6c1b663a (patch)
tree445f2dd2d696ec1b8d346f8c97ffb04101596f42 /src
parent1ad7a1e3d8da7b00a9e589c201fe79e5b9541692 (diff)
downloadmruby-606a1665c5cfff42622687d693b9362b6c1b663a.tar.gz
mruby-606a1665c5cfff42622687d693b9362b6c1b663a.zip
C++ compilability - avoid 'goto' across a variable initialization
C++ is pickier about when a 'goto' can cross a variable being delcared. The fix is to just add a set of braces to restrict the variable's scope. Without this, g++ will fail with: regcomp.c:3057: error: jump to label 'set_call_attr' regcomp.c:3087: error: from here regcomp.c:3041: error: skips initialization of 'int gnum'
Diffstat (limited to 'src')
-rw-r--r--src/regcomp.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/regcomp.c b/src/regcomp.c
index bb45b3db4..523124b26 100644
--- a/src/regcomp.c
+++ b/src/regcomp.c
@@ -3038,19 +3038,21 @@ setup_subexp_call(Node* node, ScanEnv* env)
Node** nodes = SCANENV_MEM_NODES(env);
if (cn->group_num != 0) {
- int gnum = cn->group_num;
+ {
+ int gnum = cn->group_num;
#ifdef USE_NAMED_GROUP
- if (env->num_named > 0 &&
- IS_SYNTAX_BV(env->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) &&
- !ONIG_IS_OPTION_ON(env->option, ONIG_OPTION_CAPTURE_GROUP)) {
- return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED;
- }
+ if (env->num_named > 0 &&
+ IS_SYNTAX_BV(env->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) &&
+ !ONIG_IS_OPTION_ON(env->option, ONIG_OPTION_CAPTURE_GROUP)) {
+ return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED;
+ }
#endif
- if (gnum > env->num_mem) {
- onig_scan_env_set_error_string(env,
- ONIGERR_UNDEFINED_GROUP_REFERENCE, cn->name, cn->name_end);
- return ONIGERR_UNDEFINED_GROUP_REFERENCE;
+ if (gnum > env->num_mem) {
+ onig_scan_env_set_error_string(env,
+ ONIGERR_UNDEFINED_GROUP_REFERENCE, cn->name, cn->name_end);
+ return ONIGERR_UNDEFINED_GROUP_REFERENCE;
+ }
}
#ifdef USE_NAMED_GROUP