Skip to content

Commit 12f8f53

Browse files
author
Pavel Marek
committed
Fix style
(cherry picked from commit c513606)
1 parent c569ace commit 12f8f53

File tree

7 files changed

+25
-19
lines changed

7 files changed

+25
-19
lines changed

com.oracle.truffle.r.native/fficall/src/truffle_nfi/rffiutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@ void *unimplemented(const char *f) {
3434
}
3535

3636
void fatalError(const char *msg) {
37-
printf("faatal error %s\n", msg);
37+
printf("fatal error %s\n", msg);
3838
exit(1);
3939
}
4040

com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/PCRE2Tests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,16 @@ void insertChildren(Node[] children) {
162162

163163
@Override
164164
public Object execute(VirtualFrame frame) {
165-
return null;
165+
throw new AssertionError("should not reach here");
166166
}
167167
}
168168

169+
/**
170+
* Expected data roughly corresponds to the output of some regular expression tester, like
171+
* <a href="https://regex101.com/">regex101</a>.
172+
*/
169173
// @formatter:off
174+
// Checkstyle: stop
170175
@DataPoints
171176
public static TestData[] testData = {
172177
TestData.builder().pattern("X").subject("aaa").expectedMatchIndexes(new int[]{}).build(),
@@ -255,6 +260,7 @@ public Object execute(VirtualFrame frame) {
255260
.build(),
256261
};
257262
// @formatter:on
263+
// Checkstyle: resume
258264

259265
@Before
260266
public void init() {
@@ -265,6 +271,8 @@ public void init() {
265271
captureNamesNode = RFFIFactory.getPCRE2RFFI().createGetCaptureNamesNode();
266272
captureCountNode = RFFIFactory.getPCRE2RFFI().createGetCaptureCountNode();
267273
interop = InteropLibrary.getUncached();
274+
// Some of the nodes that we initialize in this method have to be adopted. Therefore,
275+
// we adopt them into this artificial root node.
268276
testRootNode = new TestRootNode();
269277
testRootNode.insertChildren(new Node[]{compileNode, matchNode, memoryReleaseNode, captureNamesNode, captureCountNode});
270278
return null;

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/PCRE2RFFI.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.oracle.truffle.api.CompilerDirectives;
2727
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2828
import com.oracle.truffle.api.TruffleLogger;
29-
import com.oracle.truffle.api.dsl.Cached;
3029
import com.oracle.truffle.api.dsl.ImportStatic;
3130
import com.oracle.truffle.api.interop.InteropLibrary;
3231
import com.oracle.truffle.api.interop.TruffleObject;
@@ -419,10 +418,10 @@ public CompileResult execute(String pattern, int options) {
419418
int[] errorCode = new int[]{0};
420419
int[] errorOffSet = new int[]{-1};
421420
// We want to enable UTF-based matching by default.
422-
options |= Option.UTF.value;
421+
int optionsWithUTF = options | Option.UTF.value;
423422
byte[] patternBytes = pattern.getBytes(StandardCharsets.UTF_8);
424423
NativeCharArray patternCharArray = new NativeCharArray(patternBytes);
425-
Object pcreCode = call(NativeFunction.compile, patternCharArray, patternBytes.length, options, errorCode, errorOffSet);
424+
Object pcreCode = call(NativeFunction.compile, patternCharArray, patternBytes.length, optionsWithUTF, errorCode, errorOffSet);
426425
String errorMessage = null;
427426
if (interop.isNull(pcreCode)) {
428427
assert errorOffSet[0] >= 0;

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeCharArray.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,14 +34,13 @@
3434
* A {@link TruffleObject} that represents an array of {@code unsigned char} values, that is
3535
* {@code NULL} terminated in the C domain.
3636
*
37-
* Note that {@link #getArrayLength()} returns effective length, which means that the length
38-
* also includes the terminating null.
37+
* Note that {@link #getArrayLength()} returns effective length, which means that the length also
38+
* includes the terminating null.
3939
*
40-
* Beware of using {@code strlen} on instances of this
41-
* class, as it will return different results on LLVM and on NFI (on LLVM, the return value
42-
* will include the terminating null). If you plan to use an instance of this class as string
43-
* in native code, pass along the length of the string to the native, do not compute it in
44-
* the native code via {@code strlen}.
40+
* Beware of using {@code strlen} on instances of this class, as it will return different results on
41+
* LLVM and on NFI (on LLVM, the return value will include the terminating null). If you plan to use
42+
* an instance of this class as string in native code, pass along the length of the string to the
43+
* native, do not compute it in the native code via {@code strlen}.
4544
*/
4645
@ExportLibrary(InteropLibrary.class)
4746
public final class NativeCharArray extends NativeUInt8Array {

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeUInt8Array.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35618,7 +35618,7 @@ In gsub("a", "aa", "prAgue alley", fixed = TRUE, ignore.case = TRUE) :
3561835618
[1] "R Line 2"
3561935619

3562035620

35621-
##com.oracle.truffle.r.test.builtins.TestBuiltin_gsub.testGsubPCRE#Ignored.ImplementationError#
35621+
##com.oracle.truffle.r.test.builtins.TestBuiltin_gsub.testGsubPCRE#
3562235622
#{ gsub('([⚽])', '\\1', '─', perl=TRUE)}
3562335623
[1] "─"
3562435624

@@ -35658,7 +35658,7 @@ In gsub("a", "aa", "prAgue alley", fixed = TRUE, ignore.case = TRUE) :
3565835658
#{ gsub(pattern = 'a*', replacement = 'x', x = 'ÄaÄ', perl = TRUE) }
3565935659
[1] "xÄxÄx"
3566035660

35661-
##com.oracle.truffle.r.test.builtins.TestBuiltin_gsub.testGsubPCRE#Ignored.ImplementationError#
35661+
##com.oracle.truffle.r.test.builtins.TestBuiltin_gsub.testGsubPCRE#
3566235662
#{ gsub(pattern = 'Ä*', replacement = 'x', x = 'aÄÄÄÄÄb', perl = TRUE) }
3566335663
[1] "xaxbx"
3566435664

@@ -84952,7 +84952,7 @@ Error: invalid 'pattern' argument
8495284952
#{ sub(pattern = 'a*', replacement = 'x', x = 'ÄaÄ', perl = TRUE) }
8495384953
[1] "xÄaÄ"
8495484954

84955-
##com.oracle.truffle.r.test.builtins.TestBuiltin_sub.testSub#Ignored.ImplementationError#
84955+
##com.oracle.truffle.r.test.builtins.TestBuiltin_sub.testSub#
8495684956
#{ sub(pattern = 'Ä*', replacement = 'x', x = 'aÄÄÄÄÄb', perl = TRUE) }
8495784957
[1] "xaÄÄÄÄÄb"
8495884958

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_sub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1515
*
1616
* Copyright (c) 2012-2014, Purdue University
17-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates
17+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates
1818
*
1919
* All rights reserved.
2020
*/

0 commit comments

Comments
 (0)