On 10/21/2024 12:42 PM, Pedro Falcato wrote:
On Mon, Oct 21, 2024 at 3:49 PM Rebecca Cran via groups.io
<rebecca=bsdio....@groups.io> wrote:
Thanks, I'll fix it.
Could you confirm whether the change from STATIC to static is something
we want to go ahead with, or do we want to keep STATIC to allow
GoogleTest to work?
You don't need STATIC, doing stuff like -Dstatic= (or just #define
static in C code) Just Works. For GCC at least.
proof of horribleness: https://godbolt.org/z/EvMd6hev8
The issue here is that C uses one keyword for two distinct things:
file private members and local variables that keep state across calls,
i.e. real static variables.
If you only have static, then #define static <nothing>, you'll mess up
the local variable case under test.
Don't get me wrong, I think all of this tinkering is horribleness and I
think that mixing languages often brings these kind of compromises,
which is unfortunate.
I'm not advocating we introduce these kind of hacks, but I do think we
should be able to unit test static functions, so I'd like to see a
solution for that, which again, might just be CMocka.
Oliver
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120638): https://edk2.groups.io/g/devel/message/120638
Mute This Topic: https://groups.io/mt/108941574/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-