Common, Engine, Tools: error refactor to variadic constructor - #3084
ericoporto wants to merge 1 commit into
Conversation
Are you speaking of original code, or the new code? If this mistake was in original code, then this fix should be backported to release-3.6.3 and possibly release-3.6.2 branches. |
It is the two places below, but looking again I am wrong, the second parameter is the “comment” parameter that this PR is removing. ags/Engine/plugin/agsplugin.cpp Line 1096 in a323b3e Line 37 in a323b3e btw, I am not so sure now looking at the changes (talking about the entire PR now) if this is a good idea, since these variadic format stuff are easy to make a mistake and before because the string had to be made through String Format it was obvious what was the format and what was extra stuff. I think in the end I prefer how it worked before. |
Is not it the same situation as with any function that has a string formatting, similar to e.g. logging (Debug::Printf)? Majority of With the removal of useless "comment" argument, the constructor's arguments is only formatted string, and optionally the previous error as a first argument. |
|
I noticed there was a comment about adding EDIT: by the way, MSVC also supports a similar thing, although it's more complicated. One has to enable SAL in the build configuration: |
|
Thanks, I wanted to read more on that before and testing but didn’t found the time to sit in the computer to do so yet. |
|
@ivan-mogilko I think I am ok now with these code changes. On the code format check idea, I found some promising code in SDL: https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_stdinc.h Look that they include this SAL approach you mention but also some easier way to apply to gcc and the like, below is an example of how they use I imagine a simplified version of these could be made for our usecase. |
be51906 to
7b55fea
Compare
7b55fea to
ee0f475
Compare
|
I think I want to have #3087 done before, later this here is easier to rebase on top of that, and readjust the code changes here that are mostly very mechanical. |
fix #3028
I am leaving as a draft because I still need to look into it with more care, I know two places there was a format argument but not
%pattern to get the argument, which got fixed just because I had to look into it. There is also a few places in mfl_utils.cpp where I got type warnings and the fix is lazy.The actual error.h refactor was AI authored with minor hand touches. The actual replacement of each calls used a mix of find and replace, hand authoring and AI. I also did this on my Mac, so better let the CI catch any possible issues in other systems. Leaving it as a draft for now.
Gemini wrote that new error_test to when I was trying to reduce/simplify the modified header, because I thought it was too big. It can totally be deleted if we think it is useless.
🚨NOTE: These code changes were authored by AI, I used Gemini Flash 3.7, Claude Code and Codex GPT Sol 5.6🚨