sourcegraph / lsif-clang

Language Server Indexing Format (LSIF) generator for C, C++ and Objective C
https://lsif.dev/
35 stars 8 forks source link

Remove warning about ignored optimization argument. #61

Open varungandhi-src opened 2 years ago

varungandhi-src commented 2 years ago

Some software does not plan flags for Clang. Turns out, there are some small divergences between GCC and Clang. For example, here is a warning I got when building postgres with lsif-clang.

[1107/1108] Processing file /workspace/postgres/src/interfaces/libpq/pqexpbuffer.c
warning: optimization flag '-fexcess-precision=standard' is not supported [-Wignored-optimization-argument]

AFAICT, upstream Clang 13 has not added support for this either. According to Zig:

        // Musl adds these args to builds with gcc but clang does not support them.
        //"-fexcess-precision=standard",
        //"-frounding-math",

So it looks like -frounding-math is in the same bucket as well. The problem is that since flags are largely the same across compilation units, you end up with a log with a bunch of gunk per compilation unit, which obscures the actual output. We don't care about this, since we're only generating an index, not build output.

Since we don't care about optimization, we should implicitly append -Wno-ignored-optimization-argument to the end of the command-line. That way, such a spurious warning won't fire.