tukaani-project / xz

XZ Utils
https://tukaani.org/xz/
Other
542 stars 101 forks source link

[Bug]: MacOS autotool build fails when -werror flag is used #16

Closed JiaT75 closed 1 year ago

JiaT75 commented 1 year ago

Describe the bug

The CI/CD scripts detected this once the -werror was added.

Version

5.5.0 (master @57464bb4ebd6c0)

Operating System

MacOS

Relevant log output

/Users/runner/work/xz/xz/build-aux/../src/xz/message.c:726:20: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
                vfprintf(stderr, fmt, ap);
JiaT75 commented 1 year ago

Turns out the error is with clang and -Wformat-nonliteral. clang treats this warning differently than gcc, which allows using a non-literal format string if the function takes its format arguments as a va_list.

Unfortunately, MacOS seems to ship with gcc that really just runs clang. So this makes it harder to detect when MacOS is actually using clang.

A few solutions: