thradams / cake

Cake a C23 front end and transpiler written in C
http://thradams.com/cake/index.html
GNU General Public License v3.0
533 stars 21 forks source link

unknown warning '-Wno-conditional-constant' #154

Closed iphydf closed 6 months ago

iphydf commented 6 months ago

I get:

#14 0.907 /src/workspace/c-toxcore/toxcore/DHT.c:2822:13: warning: conditional expression is constant [-Wconditional-constant]

But I don't seem to be able to disable it with -Wno-conditional-constant.

thradams commented 6 months ago

#if ?

iphydf commented 6 months ago

It's if (LOG_LEVEL_INFO >= LOG_LEVEL_TRACE) which comes from a logging macro.

thradams commented 6 months ago

if LOG_LEVEL_INFO and LOG_LEVEL_TRACE are macros then

#if (LOG_LEVEL_INFO >= LOG_LEVEL_TRACE)
#endif
iphydf commented 6 months ago

They are enums, not macros. Also this is from a macro expansion like LOGGER_TRACE(msg, ...).

iphydf commented 6 months ago

https://github.com/TokTok/c-toxcore/blob/master/toxcore%2Flogger.h#L81

thradams commented 6 months ago

At command like

cake -Wno-conditional-constant

or

enum {A, B};
int main(){
#pragma cake diagnostic push
#pragma cake diagnostic ignored "-Wconditional-constant"
    if (B > A){}
#pragma cake diagnostic pop
}
iphydf commented 6 months ago

If I try the first option, I get:

1.278 unknown warning '-Wno-conditional-constant'
1.278  0 files in 0.00 seconds
1.278  0 errors 0 warnings 0 notes 

The second option isn't an option for me.

thradams commented 6 months ago

it should work I will check later.