Repository navigation
Conversation
|
These errors look disturbing: |
46cc033 to
8ba7ed1
Compare
It's caused by redefining 3rd-party symbols and those redefinitions applied to In this case the solution might be to ensure that we include (The ultimate solution would be replacing these redefinitions with curl-specific |
It would however change the code significantly. One of the nice parts of the current setup is that we can keep using the standard memory functions, no magic necessary. Switching away from using the standard function names takes away a portion of the beauty of this setup I think. |
It seems this happens in unity builds only, which makes depending on include order much more complicated... |
|
I'm fine with just not using unity build together with memdebug. |
|
Analysis of PR #16413 at 0d68e6eb: Test 3023 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Generated by Testclutch |
Yes, this issue is normally avoided by the comment Have you tried moving (or copying) (I think losing unity for all debug builds would be a big loss and would complicate thinking about builds.) |
I have not. It is also an unfortunate change because that header file is only needed for easy_lock.c so including it universally for every C file seems like a... non-ideal fix.
Not to be that guy, but the unity builds are actually what complicate the builds, not the other way around... |
That's disappointing to hear, given how much time it saves in CI I believe the It can not only break in unity builds, but any non-unity build #define CPU_FREE(set) free(set)The redefinition solution caused a whole bunch of ugly workarounds I still think that unity actually helped finding and dropping a whole Redefining system symbols is brittle and should not be done unless |
I know they do, and that's the reason we tolerate all the little hacks we need to do to deal with it.
I don't. They are fragile though.
Yeah, it has forced us clean up some things.
Well, we need to come back and think of the reason for doing them: we want to allow users to keep using the plain normal C functions for memory allocations but yet provide a system that can detect a certain set of mistakes involving them. I think there is a strong reason to stick to the common functions: to allow developers to know them, feel familiar with them and to not hesitate which functions to use when the they come writing new code. I think those advantages of sticking to the "real" functions are benefits that outweigh the obstacles and challenges we need to overcome in the build systems. Not too unlike to how we like to keep the unity builds in spite of the friction they cause. |
0d68e6e to
99296c0
Compare
|
speaking of quirks... 😀 |
To avoid warnings if it gets done again - like in unity builds.
|
✔️ |
- formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
- formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
- formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
- formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
finalize Alpine configs - formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
finalize Alpine configs - formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
finalize Alpine configs - formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
finalize Alpine configs - formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
finalize Alpine configs - formatting: tidy-up option order and job name. - enable unity mode again for the RR c-ares job. Follow-up to 17ab4d6 curl#16413
Fixing: - HTTPS-RR builds with c-ares and Linux MUSL. - curl-for-win minimal builds with Linux MUSL. It should fix all other kinds of entaglement between curl's redefintions of system symbols and system (or 3rd-party) headers sensitive to that. It also syncs memory override behavior between unity & non-unity builds, thus reducing build variations. The idea is to define and declare everything once in `curl_setup.h`, without overriding any system symbols with curl ones yet. Then, like before this patch, override them, if necessary, in each source file via `curl_memory.h` and `memdebug.h`, after including system headers. To ensure a clean slate with no overrides at the beginning of each source file, reset all of them unconditionally at the end of `curl_setup.h`, by including `curl_mem_undef.h`. (This assumes `curl_setup.h` is always included first, which is already the case throughout the codebase.) `curl_mem_undef.h` can also be included explicitly wherever overrides are causing problems. E.g. in tests which use unity-style builds and a previously included `curl_memory.h`/`memdebug.h` can be spilling into other source files. The simplified role of the two override headers: - `curl_memory.h`: overrides system memory allocator functions to libcurl ones, when memory tracing (aka `CURLDEBUG`) is disabled. - `memdebug.h`: overrides system memory allocator and some other functions to curl debug functions, when memory tracing is enabled. Changed made in this patch, step-by-step: - curl_memory.h: move allocator typedefs and protos to `curl_setup.h`. - memdebug.h: move `ALLOC_*` macros to `curl_setup.h`. - memdebug.h: move allocator protos to `curl_setup.h`. - memdebug.h: move `Curl_safefree()` macro to `curl_setup.h`. (it's a regular macro, with a one-time, global, definition.) - curl_memory.h: move system symbol undefs to a new, separate header: `curl_mem_undef.h`. - curl_setup.h: include `curl_mem_undef.h` at the end, unconditionally, to reset system symbol macros after each inclusion. - handle `sclose()` and `fake_sclose()` in `curl_setup.h`. They are not system symbols, a one-time definition does the job. Also: - GHA/linux: enable unity mode for the HTTP-RR c-ares MUSL job. Follow-up to 17ab4d6 #16413 That said, I'd still find it better to avoid redefining system macros. To communicate clearly the fact that they are not the original system calls and they do behave differently. And, it would allow dropping the undef/redef dance in each source file, and maintaining the logic with it. The "last #include files should be in this order" comments in each source would also become unnecessary. Also the trick of using `(func)` (or interim macros) to call the non-overridden function where required. This method works for printf and most everything else already. For `_tcsdup`, socket and fopen functions this could work without disturbing the codebase much. Ref: #16428 (clean reboot of) Closes #17827
No description provided.