# Clang-tidy issues warning -fno-fat-lto-objects

**URL:** https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501
**Category:** Usage
**Created:** [September 19, 2022, 6:59am UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501 "2022-09-19T06:59:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [September 19, 2022, 6:59am UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501/1 "2022-09-19T06:59:54Z")

</div>

Hi,

I use clang-tidy and gcc (on Windows with cross-compilation but that shouldn’t matter).

Later clang versions now warn about  
warning: optimization flag ‘-fno-fat-lto-objects’ is not supported [clang-diagnostic-ignored-optimization-argument]

Since CMake adds this flag when enabling IPO/LTO for gcc, could it also make sure that unsuitable flags are filtered for clang-tidy?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 29, 2022, 1:35pm UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501/2 "2022-09-29T13:35:20Z")

</div>

An issue could be filed, but these kinds of “what versions of `clang-tidy` know about which flags” is a monumental task and never-ending problem. Some kind of genex that does “hide this flag from `clang-tidy`” (or `iwyu` or whatever other co-compiles are out there) is probably the better way to do it long-term.

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [September 29, 2022, 6:14pm UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501/3 "2022-09-29T18:14:55Z")

</div>

CMake already knows what the IPO flags are and that those are useless for a static analyzer.

I think the main problem is the way the command line is forwarded to clang-tidy, piped through cmake itself that knows nothing from configuration time.

At the same time, clang-tidy is unable to disable a useless warning. 😕

Maybe I’ll just write a thin wrapper around clang-tidy, filtering command line arguments.

The mentioned argument NEVER worked for clang-tidy, so the version really doesn’t matter for this specific problem.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 29, 2022, 7:33pm UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501/4 "2022-09-29T19:33:29Z")

</div>

Ah, true; CMake might be able to do this in this specific instance. However:

> [@hsattler](#):
>
> The mentioned argument NEVER worked for clang-tidy, so the version really doesn’t matter for this specific problem.

Knowing that this is true for any specific flag is not easy to know and baking it into CMake is a hazard as the time dimension is not ignorable in its case.
