"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
got diff chomps trailing \r
To:
gameoftrees@openbsd.org
Date:
Wed, 10 May 2023 17:29:31 +0200

Download raw body.

Thread
Last night I tried to generate a diff between OpenBSD src "master" and
an updated "llvm15" branch.  Unfortunately, the output of "got diff"
would not apply to a checked-out src tree and I had to resort to git.

Some of the LLVM files have \r\n line endings.  The problem is that
got diff simply drops the \r from all context, - and + lines.

===> got diff | cat -v

--- gnu/llvm/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
+++ gnu/llvm/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
@@ -91,12 +91,8 @@ int main(int argc, const char **argv) {^M
   llvm::transform(Args, Argv.begin(),
                   [](const std::string &Arg) { return Arg.c_str(); });
 
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
-  unsigned MissingArgIndex, MissingArgCount;
-  auto Opts = driver::getDriverOptTable();
-  auto ParsedArgs = Opts.ParseArgs(llvm::makeArrayRef(Argv).slice(1),
-                                   MissingArgIndex, MissingArgCount);
-  ParseDiagnosticArgs(*DiagOpts, ParsedArgs);
+  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts =
+      CreateAndPopulateDiagOpts(Argv);
 
   // Don't output diagnostics, because common scenarios such as
   // cross-compiling fail with diagnostics.  This is not fatal, but

===> git diff | cat -v

--- a/gnu/llvm/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
+++ b/gnu/llvm/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
@@ -91,12 +91,8 @@ int main(int argc, const char **argv) {
   llvm::transform(Args, Argv.begin(),^M
                   [](const std::string &Arg) { return Arg.c_str(); });^M
 ^M
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();^M
-  unsigned MissingArgIndex, MissingArgCount;^M
-  auto Opts = driver::getDriverOptTable();^M
-  auto ParsedArgs = Opts.ParseArgs(llvm::makeArrayRef(Argv).slice(1),^M
-                                   MissingArgIndex, MissingArgCount);^M
-  ParseDiagnosticArgs(*DiagOpts, ParsedArgs);^M
+  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts =^M
+      CreateAndPopulateDiagOpts(Argv);^M
 ^M
   // Don't output diagnostics, because common scenarios such as^M
   // cross-compiling fail with diagnostics.  This is not fatal, but^M


Ironically, got preserves the \r for the function name line, but
git doesn't.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de