dgibson / dtc

Device Tree Compiler
219 stars 130 forks source link

fix MinGW format attribute #125

Closed neheb closed 7 months ago

neheb commented 7 months ago

Setting -D__USE_MINGW_ANSI_STDIO=1 is wrong and should not be used. MinGW internally uses a macro to select between gnu_printf and printf. Just use that instead of using a wrong format under clang backends.

dgibson commented 7 months ago

@elmarco you originally added that -D as part of the meson build. Does this change seem reasonable to you?

elmarco commented 7 months ago

The rationale is from commit 588a29ff2e4e9291143d837daa6b9b5f0a9fa91c. I don't know whether this has changed.

Using __MINGW_PRINTF_FORMAT makes the situation even more complex imho, as we end up with 3 format variants.

@neheb what are you solving? clang doesn't support __USE_MINGW_ANSI_STDIO ?

neheb commented 7 months ago

clang doesn’t support gnu_printf. That define is used to solve format warnings when ms_printf is used. It’s not the correct solution.

elmarco commented 7 months ago

as long as it compiles and run the tests, I guess it's fine. @dgibson

dgibson commented 7 months ago

Well, the tests aren't so useful, since I'm not set up to do Windows builds. Oh well, I don't see anything obviously wrong, so applying.

dgibson commented 7 months ago

@neheb if you have the chance and ability to add a github job for windows builds of dtc, that would be fantastic. I don't know enough about either gitlab actions or windows to do so.