--- Log opened Thu Apr 28 00:00:07 2022 00:00 -!- belcher [~belcher@user/belcher] has joined #bitcoin-core-builds 00:01 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds 00:14 -!- belcher [~belcher@user/belcher] has quit [Ping timeout: 250 seconds] 00:28 -!- belcher [~belcher@user/belcher] has joined #bitcoin-core-builds 00:51 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has quit [Ping timeout: 240 seconds] 00:54 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds 02:00 -!- robertspigler [~robertspi@2001:470:69fc:105::2d53] has quit [Quit: You have been kicked for being idle] 02:14 -!- jonatack [jonatack@user/jonatack] has joined #bitcoin-core-builds 09:12 < dongcarl> Anyone got an idea for how to find and replace the last occurance of a regex in a file in a way that works in a scripted-diff? 09:21 < laanwj> you mean the last occurence of a regex on a line, or in a file? 09:25 < laanwj> ohh in a file, you already say 09:25 < laanwj> no, no idea 09:31 < dongcarl> grep -n | tail | cut + sed seems to work alright :-) 09:31 < laanwj> i mean at some point you'd want an actual programming language instead of shell hacks 09:31 < laanwj> oh nice! 09:32 < dongcarl> Haha yeah, well then we'll have to start deciding minimal dependencies for our scripted-diff environment... 09:33 < laanwj> arguably that's already the case with which commands you can use, something like 'base python3.6' would be more contained 09:34 < laanwj> that said, scripted diff is for relatively simple manipulations anyway 09:35 < laanwj> i understand what you mean, like, 'what if we want an C++ ast parsing library' that's where it gets interesting :) 09:35 < dongcarl> clang-tidy 👀 09:36 < laanwj> right 09:38 < laanwj> that's only the beginning, i suppose you could write every code change as a series of AST manipulations— 09:42 < dongcarl> 🤯 09:55 -!- jonatack [jonatack@user/jonatack] has quit [Ping timeout: 248 seconds] 10:11 -!- jonatack [jonatack@user/jonatack] has joined #bitcoin-core-builds 10:31 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has quit [Remote host closed the connection] 10:31 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds 12:23 < cfields> laanwj: laanwj: that's exactly what I've snuck off to work on for the last few weeks. Here's an example of a plugin that will not only replace our LogPrintf linter, but it can also give you a patch with the fixes :) 12:24 < cfields> https://github.com/theuni/bitcoin-tidy/blob/main/LogPrintfCheck.cpp 12:24 < cfields> my real project is a larger automation that produces a several hundred/thousand line diff that would be (imo) otherwise unreviewable. I've been trying to figure out if that's a viable way to do big changes. 12:26 < laanwj> cfields: that's great :) 12:26 < cfields> but I ran into a roadblock: llvm doesn't support custom attribute parsing, which ends up _really_ hampering what you can express to the tooling. So I've taken a detour and I'm working on upstreaming support for that. 12:26 < cfields> Working POC: https://github.com/theuni/llvm-project/tree/pluginattr 12:26 < laanwj> I tried to mess around with that once too but the API completely changed every clang release at some point i gave up 12:27 < jonatack> cfields: wowza 12:27 < laanwj> yes, attribute parsing seems fairly important 12:27 < cfields> laanwj: Yeah. I feel safer in that regard working in their AST language. The changes are more like soft-forks. 12:28 < laanwj> i think that was another thing, there was always something missing or some information it wasn't possible to get at 12:29 < cfields> laanwj: the logprintf is a perfect example of why custom attr handling matters. It's one thing for a plugin to have a check for "a function that's called logprintf that's used correctly". But it would be 100x nicer to annotate the param in the definition of Logprintf(..,., char* str [[needseol]] 12:29 < cfields> That way, there's no voodoo. It's right there in the source what should be happening. 12:30 < laanwj> cfields: though in any case it's better than the line based regexp based check 12:30 < laanwj> hardcoding function names or not : 12:31 < cfields> laanwj: yep. But a good example of what you said above.. you don't get access to comments in the AST. So our current mechanism of saying "//ok" (or whatever it is) can't be used as a bypass for the plugin. 12:31 < cfields> :( 12:31 < laanwj> how's the performance? we used cppcheck at some point which also does more thorough parsing, but running it over the entire codebase is just insanely slow 12:32 < laanwj> like, more than half an hour 12:33 < cfields> I haven't really checked tbh. When I've done the whole codebase i've mostly been doing the big transform I mentioned above. And each object, I dunno 1-2x as long as a compile? 12:35 < cfields> I know there are things that kill performance in matchers that you're told to avoid at all costs. Mathcers like forEachDescendant which can blow up exponentially. 12:37 < laanwj> that's certainly acceptable for a big transform, linters would preferable run really quickly so that they finish before the other CI runs 12:39 < cfields> laanwj: for quick things that don't require generating fixes, clang compiler plugins can be used instead so that warnings/errors can be generated as a side-effect of the build process as usual. I've been messing with those as part of my exploring :) 12:39 < cfields> https://github.com/theuni/bitcoin-core-clang-plugin 12:40 < cfields> same problem as what you mentioned above, though. Even though the AST stuff is likely to be pretty solid, the rest of the clang/llvm abi is unstable. so they'll likely always need to be built per-version :( 15:19 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has quit [Ping timeout: 248 seconds] 15:25 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds 16:01 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has quit [Ping timeout: 250 seconds] 18:39 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds 19:25 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has quit [Ping timeout: 260 seconds] 21:25 -!- ryanofsky [~russ@jumpy.yanofsky.org] has quit [Ping timeout: 260 seconds] 21:26 -!- ryanofsky [russ@jumpy.yanofsky.org] has joined #bitcoin-core-builds 23:45 -!- sipsorcery [~sipsorcer@2a02:8084:6180:500::12b] has joined #bitcoin-core-builds --- Log closed Fri Apr 29 00:00:08 2022