[llvm] 92d31a7 - Silence some format specifier warnings
Aaron Ballman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 08:54:21 PDT 2022
Author: Aaron Ballman
Date: 2022-06-27T11:54:12-04:00
New Revision: 92d31a7cdffaaea0171db95c74922eea5ed70312
URL: https://github.com/llvm/llvm-project/commit/92d31a7cdffaaea0171db95c74922eea5ed70312
DIFF: https://github.com/llvm/llvm-project/commit/92d31a7cdffaaea0171db95c74922eea5ed70312.diff
LOG: Silence some format specifier warnings
This solves a format specifier warning for char32_t being converted to
an unsigned integer type, and multiple format specifier warnings for
size_t being converted to long.
Added:
Modified:
llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
index 5aae1822eb974..cd3da88d2d089 100644
--- a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
+++ b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
@@ -365,7 +365,7 @@ int main(int argc, char **argv) {
})) {
continue;
}
- printf("%06x: %s\n", Codepoint, Name.c_str());
+ printf("%06x: %s\n", static_cast<unsigned int>(Codepoint), Name.c_str());
T.insert(Name, Codepoint);
LongestName =
std::max(LongestName, std::size_t(llvm::count_if(Name, [](char c) {
@@ -413,7 +413,7 @@ int main(int argc, char **argv) {
fprintf(Out, "const char* UnicodeNameToCodepointDict = \"%s\";\n",
Dict.c_str());
- fprintf(Out, "uint8_t UnicodeNameToCodepointIndex_[%lu] = {\n",
+ fprintf(Out, "uint8_t UnicodeNameToCodepointIndex_[%zu] = {\n",
Tree.size() + 1);
for (auto Byte : Tree) {
@@ -423,10 +423,10 @@ int main(int argc, char **argv) {
fprintf(Out, "0};");
fprintf(Out, "const uint8_t* UnicodeNameToCodepointIndex = "
"UnicodeNameToCodepointIndex_; \n");
- fprintf(Out, "const std::size_t UnicodeNameToCodepointIndexSize = %lu;\n",
+ fprintf(Out, "const std::size_t UnicodeNameToCodepointIndexSize = %zu;\n",
Tree.size() + 1);
fprintf(Out,
- "const std::size_t UnicodeNameToCodepointLargestNameSize = %lu;\n",
+ "const std::size_t UnicodeNameToCodepointLargestNameSize = %zu;\n",
LongestName);
fprintf(Out, "\n}}}\n");
fclose(Out);
More information about the llvm-commits
mailing list