Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Aug 10, 2019
1 parent 2e2a694 commit 2ec7e7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions base/printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Printf

using .Base.Ryu

export @printf, @sprintf
export @printf, @sprintf, Format, format, @format

const Ints = Union{Val{'d'}, Val{'i'}, Val{'u'}, Val{'x'}, Val{'X'}, Val{'o'}}
const Floats = Union{Val{'e'}, Val{'E'}, Val{'f'}, Val{'F'}, Val{'g'}, Val{'G'}, Val{'a'}, Val{'A'}}
Expand Down Expand Up @@ -118,7 +118,7 @@ function Format(f::AbstractString)
pos += 1
end
# parse type
!(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f'"))
!(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f', invalid type specifier: '$(Char(b))'"))
type = Val{Char(b)}
if type <: Ints && precision > 0
zero = false
Expand Down Expand Up @@ -428,17 +428,17 @@ macro printf(io_or_fmt, fmt_or_first_arg, args...)
if io_or_fmt isa String
io = stdout
fmt = Format(io_or_fmt)
return esc(:(Printf.format($io, $fmt, $fmt_or_first_arg, $(args...))))
return esc(:(Base.Printf.format($io, $fmt, $fmt_or_first_arg, $(args...))))
else
io = io_or_fmt
fmt = Format(fmt_or_first_arg)
return esc(:(Printf.format($io, $fmt, $(args...))))
return esc(:(Base.Printf.format($io, $fmt, $(args...))))
end
end

macro sprintf(fmt, args...)
f = Format(fmt)
return esc(:(Printf.format($f, $(args...))))
return esc(:(Base.Printf.format($f, $(args...))))
end

end # module
4 changes: 3 additions & 1 deletion contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ function generate_precompile_statements()
# Extract the precompile statements from stderr
statements = Set{String}()
for statement in eachline(precompile_file_h)
(occursin("Main.", statement) || occursin("Printf.", statement)) && continue
(occursin("Main.", statement) ||
occursin("Printf.", statement) ||
occursin("Base.io_has_tvar_name", statement)) && continue
# check for `#x##s66` style variable names not in quotes
occursin(r"#\w", statement) &&
count(r"(?:#+\w+)+", statement) !=
Expand Down

0 comments on commit 2ec7e7c

Please sign in to comment.