Skip to content

Instantly share code, notes, and snippets.

@shyouhei shyouhei/1-README.md
Last active Jul 22, 2019

Embed
What would you like to do?
include-what-you-use is a garbage.

https://github.com/include-what-you-use/include-what-you-use is a garbage.

For instance when we have the following C file:

#include <time.h>
struct tm x;

iwyu generates the following garbage output:

zsh % iwyu 99-tmp.c

99-tmp.c should add these lines:
#include <bits/types/struct_tm.h>  // for tm

99-tmp.c should remove these lines:
- #include <time.h>  // lines 1-1

The full include-list for 99-tmp.c:
#include <bits/types/struct_tm.h>  // for tm
---
[1]    12133 exit 4     iwyu tmp.c

Which is totally nonsense. <time.h> is defined to have struct tm in ISO C since forever (cf: ISO/IEC 9899:2018 section 7.27).

struct tm is not the only entity that iwyu miss; for another instance max_align_t is missing. Not to mention other entities in POSIX and C++.

This tool is worse than being useless. The suggestion miserably breaks portability. Just trash it.

#include <time.h>
struct tm x;
@shyouhei

This comment has been minimized.

Copy link
Owner Author

shyouhei commented Jul 22, 2019

In order for iwyu to become a non-toy, IMO it should leave all #include <foo> -style lines as-is and focus on #include "foo", or at least understand #pragma gcc system_header to ignore symbols from such files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.