Skip to content

Commit 93ce36c

Browse files
authored
Merge pull request #48709 from JuliaLang/prohibit-tabs-in-whitespace-check
Prohibit tabs in whitespace check
2 parents 5e7d7c3 + 36f6826 commit 93ce36c

File tree

11 files changed

+75
-63
lines changed

11 files changed

+75
-63
lines changed

HISTORY.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5564,18 +5564,18 @@ Deprecated or removed
55645564
55655565
* several syntax whitespace insensitivities have been deprecated ([#11891]).
55665566
```julia
5567-
# function call
5568-
f (x)
5569-
5570-
# getindex
5571-
x [17]
5572-
rand(2) [1]
5573-
5574-
# function definition
5575-
f (x) = x^2
5576-
function foo (x)
5577-
x^2
5578-
end
5567+
# function call
5568+
f (x)
5569+
5570+
# getindex
5571+
x [17]
5572+
rand(2) [1]
5573+
5574+
# function definition
5575+
f (x) = x^2
5576+
function foo (x)
5577+
x^2
5578+
end
55795579
```
55805580
55815581
* indexing with `Real`s that are not subtypes of `Integer` (`Rational`, `AbstractFloat`, etc.) has been deprecated ([#10458]).

base/arrayshow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function _print_matrix(io, @nospecialize(X::AbstractVecOrMat), pre, sep, post, h
202202
if n > maxpossiblecols
203203
colsA = [colsA[(0:maxpossiblecols-1) .+ firstindex(colsA)]; colsA[(end-maxpossiblecols+1):end]]
204204
else
205-
colsA = [colsA;]
205+
colsA = [colsA;]
206206
end
207207
A = alignment(io, X, rowsA, colsA, screenwidth, screenwidth, sepsize, ncols)
208208
# Nine-slicing is accomplished using print_matrix_row repeatedly

base/compiler/typeinfer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ function CodeInstance(interp::AbstractInterpreter, result::InferenceResult,
332332
widenconst(result_type), rettype_const, inferred_result,
333333
const_flags, first(valid_worlds), last(valid_worlds),
334334
# TODO: Actually do something with non-IPO effects
335-
encode_effects(result.ipo_effects), encode_effects(result.ipo_effects), result.argescapes,
335+
encode_effects(result.ipo_effects), encode_effects(result.ipo_effects), result.argescapes,
336336
relocatability)
337337
end
338338

contrib/check-whitespace.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ const patterns = split("""
1818
*Makefile
1919
""")
2020

21+
allow_tabs(path) =
22+
path == "Make.inc" ||
23+
endswith(path, "Makefile") ||
24+
endswith(path, ".make") ||
25+
endswith(path, ".mk") ||
26+
startswith(path, joinpath("src", "support")) ||
27+
startswith(path, joinpath("src", "flisp")) ||
28+
endswith(path, joinpath("test", "syntax.jl")) ||
29+
endswith(path, joinpath("test", "triplequote.jl"))
30+
2131
const errors = Set{Tuple{String,Int,String}}()
2232

2333
for path in eachline(`git ls-files -- $patterns`)
@@ -32,6 +42,8 @@ for path in eachline(`git ls-files -- $patterns`)
3242
lineno += 1
3343
contains(line, '\r') && file_err("non-UNIX line endings")
3444
contains(line, '\ua0') && line_err("non-breaking space")
45+
allow_tabs(path) ||
46+
contains(line, '\t') && line_err("tab")
3547
endswith(line, '\n') || line_err("no trailing newline")
3648
line = chomp(line)
3749
endswith(line, r"\s") && line_err("trailing whitespace")

doc/src/devdocs/probes.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@ to enable USDT probes.
2727
> readelf -n usr/lib/libjulia-internal.so.1
2828
2929
Displaying notes found in: .note.gnu.build-id
30-
Owner Data size Description
31-
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
30+
Owner Data size Description
31+
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
3232
Build ID: 57161002f35548772a87418d2385c284ceb3ead8
3333
3434
Displaying notes found in: .note.stapsdt
35-
Owner Data size Description
36-
stapsdt 0x00000029 NT_STAPSDT (SystemTap probe descriptors)
35+
Owner Data size Description
36+
stapsdt 0x00000029 NT_STAPSDT (SystemTap probe descriptors)
3737
Provider: julia
3838
Name: gc__begin
3939
Location: 0x000000000013213e, Base: 0x00000000002bb4da, Semaphore: 0x0000000000346cac
4040
Arguments:
41-
stapsdt 0x00000032 NT_STAPSDT (SystemTap probe descriptors)
41+
stapsdt 0x00000032 NT_STAPSDT (SystemTap probe descriptors)
4242
Provider: julia
4343
Name: gc__stop_the_world
4444
Location: 0x0000000000132144, Base: 0x00000000002bb4da, Semaphore: 0x0000000000346cae
4545
Arguments:
46-
stapsdt 0x00000027 NT_STAPSDT (SystemTap probe descriptors)
46+
stapsdt 0x00000027 NT_STAPSDT (SystemTap probe descriptors)
4747
Provider: julia
4848
Name: gc__end
4949
Location: 0x000000000013214a, Base: 0x00000000002bb4da, Semaphore: 0x0000000000346cb0
5050
Arguments:
51-
stapsdt 0x0000002d NT_STAPSDT (SystemTap probe descriptors)
51+
stapsdt 0x0000002d NT_STAPSDT (SystemTap probe descriptors)
5252
Provider: julia
5353
Name: gc__finalizer
5454
Location: 0x0000000000132150, Base: 0x00000000002bb4da, Semaphore: 0x0000000000346cb2
@@ -308,7 +308,7 @@ An example probe in the bpftrace format looks like:
308308
```
309309
usdt:usr/lib/libjulia-internal.so:julia:gc__begin
310310
{
311-
@start[pid] = nsecs;
311+
@start[pid] = nsecs;
312312
}
313313
```
314314

src/jitlayers.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,33 @@ extern "C" {
9494

9595
enum class MSanTLS
9696
{
97-
param = 1, // __msan_param_tls
98-
param_origin, //__msan_param_origin_tls
99-
retval, // __msan_retval_tls
100-
retval_origin, //__msan_retval_origin_tls
101-
va_arg, // __msan_va_arg_tls
102-
va_arg_origin, // __msan_va_arg_origin_tls
103-
va_arg_overflow_size, // __msan_va_arg_overflow_size_tls
104-
origin, //__msan_origin_tls
97+
param = 1, // __msan_param_tls
98+
param_origin, //__msan_param_origin_tls
99+
retval, // __msan_retval_tls
100+
retval_origin, //__msan_retval_origin_tls
101+
va_arg, // __msan_va_arg_tls
102+
va_arg_origin, // __msan_va_arg_origin_tls
103+
va_arg_overflow_size, // __msan_va_arg_overflow_size_tls
104+
origin, //__msan_origin_tls
105105
};
106106

107107
static void *getTLSAddress(void *control)
108108
{
109-
auto tlsIndex = static_cast<MSanTLS>(reinterpret_cast<uintptr_t>(control));
110-
switch(tlsIndex)
111-
{
112-
case MSanTLS::param: return reinterpret_cast<void *>(&__msan_param_tls);
113-
case MSanTLS::param_origin: return reinterpret_cast<void *>(&__msan_param_origin_tls);
114-
case MSanTLS::retval: return reinterpret_cast<void *>(&__msan_retval_tls);
115-
case MSanTLS::retval_origin: return reinterpret_cast<void *>(&__msan_retval_origin_tls);
116-
case MSanTLS::va_arg: return reinterpret_cast<void *>(&__msan_va_arg_tls);
117-
case MSanTLS::va_arg_origin: return reinterpret_cast<void *>(&__msan_va_arg_origin_tls);
118-
case MSanTLS::va_arg_overflow_size: return reinterpret_cast<void *>(&__msan_va_arg_overflow_size_tls);
119-
case MSanTLS::origin: return reinterpret_cast<void *>(&__msan_origin_tls);
120-
default:
121-
assert(false && "BAD MSAN TLS INDEX");
122-
return nullptr;
123-
}
109+
auto tlsIndex = static_cast<MSanTLS>(reinterpret_cast<uintptr_t>(control));
110+
switch(tlsIndex)
111+
{
112+
case MSanTLS::param: return reinterpret_cast<void *>(&__msan_param_tls);
113+
case MSanTLS::param_origin: return reinterpret_cast<void *>(&__msan_param_origin_tls);
114+
case MSanTLS::retval: return reinterpret_cast<void *>(&__msan_retval_tls);
115+
case MSanTLS::retval_origin: return reinterpret_cast<void *>(&__msan_retval_origin_tls);
116+
case MSanTLS::va_arg: return reinterpret_cast<void *>(&__msan_va_arg_tls);
117+
case MSanTLS::va_arg_origin: return reinterpret_cast<void *>(&__msan_va_arg_origin_tls);
118+
case MSanTLS::va_arg_overflow_size: return reinterpret_cast<void *>(&__msan_va_arg_overflow_size_tls);
119+
case MSanTLS::origin: return reinterpret_cast<void *>(&__msan_origin_tls);
120+
default:
121+
assert(false && "BAD MSAN TLS INDEX");
122+
return nullptr;
123+
}
124124
}
125125
}
126126
#endif

src/julia_atomics.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ enum jl_memory_order {
7979
* `mfence`. GCC 11 did switch to this representation. See #48123
8080
*/
8181
#if defined(_CPU_X86_64_) && \
82-
((defined(__GNUC__) && __GNUC__ < 11) || \
83-
(defined(__clang__)))
82+
((defined(__GNUC__) && __GNUC__ < 11) || \
83+
(defined(__clang__)))
8484
#define jl_fence() __asm__ volatile("lock orq $0 , (%rsp)")
8585
#else
8686
#define jl_fence() atomic_thread_fence(memory_order_seq_cst)

src/signals-unix.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ int is_write_fault(void *context) {
299299
}
300300
#elif defined(_OS_LINUX_) && defined(_CPU_AARCH64_)
301301
struct linux_aarch64_ctx_header {
302-
uint32_t magic;
303-
uint32_t size;
302+
uint32_t magic;
303+
uint32_t size;
304304
};
305305
const uint32_t linux_esr_magic = 0x45535201;
306306

@@ -767,7 +767,7 @@ static void *signal_listener(void *arg)
767767
profile = (sig == SIGUSR1);
768768
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
769769
if (profile && !(info.si_code == SI_TIMER &&
770-
info.si_value.sival_ptr == &timerprof))
770+
info.si_value.sival_ptr == &timerprof))
771771
profile = 0;
772772
#endif
773773
#endif

stdlib/Markdown/test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ end
11491149
# issue 20225, check this can print
11501150
@test typeof(sprint(Markdown.term, Markdown.parse(" "))) == String
11511151

1152-
# different output depending on whether color is requested: +# issue 20225, check this can print
1152+
# different output depending on whether color is requested: +# issue 20225, check this can print
11531153
let buf = IOBuffer()
11541154
@test typeof(sprint(Markdown.term, Markdown.parse(" "))) == String
11551155
show(buf, "text/plain", md"*emph*")

stdlib/Test/docs/src/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ using Test
405405

406406
@testset "Example tests" begin
407407

408-
@testset "Math tests" begin
409-
include("math_tests.jl")
410-
end
408+
@testset "Math tests" begin
409+
include("math_tests.jl")
410+
end
411411

412-
@testset "Greeting tests" begin
413-
include("greeting_tests.jl")
414-
end
412+
@testset "Greeting tests" begin
413+
include("greeting_tests.jl")
414+
end
415415
end
416416
```
417417

@@ -426,16 +426,16 @@ Using our knowledge of `Test.jl`, here are some example tests we could add to `m
426426

427427
```julia
428428
@testset "Testset 1" begin
429-
@test 2 == simple_add(1, 1)
430-
@test 3.5 == simple_add(1, 2.5)
429+
@test 2 == simple_add(1, 1)
430+
@test 3.5 == simple_add(1, 2.5)
431431
@test_throws MethodError simple_add(1, "A")
432432
@test_throws MethodError simple_add(1, 2, 3)
433433
end
434434

435435
@testset "Testset 2" begin
436-
@test 1.0 == type_multiply(1.0, 1.0)
436+
@test 1.0 == type_multiply(1.0, 1.0)
437437
@test isa(type_multiply(2.0, 2.0), Float64)
438-
@test_throws MethodError type_multiply(1, 2.5)
438+
@test_throws MethodError type_multiply(1, 2.5)
439439
end
440440
```
441441

0 commit comments

Comments
 (0)