From 1d81ec3730deefe194a1559c6fa4d08252362142 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 20 Aug 2022 22:30:45 -0700 Subject: [PATCH] Update include-what-you-use darwin mapping file Fixed a line or two tripped IWYU asserts about visibility when doing e.g. a private -> public mapping but the visibility it came up with was identical. Like the to mapping, it was defined as private -> public but they're both "public". Added a whole bunch of lines necessary to get sane/correct reccomendations from current IWYU on clang 10 on macOS Ventura. Incrementally I manually added these as needed while going through each line change IWYU wanted in each file. --- build_tools/iwyu.osx.imp | 96 +++++++++++++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 17 deletions(-) diff --git a/build_tools/iwyu.osx.imp b/build_tools/iwyu.osx.imp index ecb5a3a49..342d8f301 100644 --- a/build_tools/iwyu.osx.imp +++ b/build_tools/iwyu.osx.imp @@ -2,10 +2,27 @@ # the version installed by HomeBrew doesn't have useful mappings for the # system provided headers. This also has mappings for FreeBSD. [ + { include: ["<__functional_base>", private, "", public ] }, + { include: ["<__mutex_base>", private, "", public ] }, + { include: ["@<__algorithm/.*>", "private", "", "public"] }, + { include: ["@<__iterator/.*>", "private", "", "public"] }, + { include: ["@<__functional/.*>", "private", "", "public"] }, + { include: ["@<__memory/.*>", "private", "", "public"] }, + { include: ["@<__utility/.*>", "private", "", "public"] }, + { include: ["@<__chrono/.*>", "private", "", "public"] }, + { include: ["@<__numeric/.*>", "private", "", "public"] }, + { include: ["@<__random/.*>", "private", "", "public"] }, + { include: ["@<__locale/.*>", "private", "", "public"] }, + { include: ["@", "private", "", "public"] }, +# ratio false positive. See https://groups.google.com/g/include-what-you-use/c/OKVkkWUlx44 + { include: ["", "public", "", "public"] }, + { include: ["<__locale>", "private", "", "public"] }, + { include: ["<_ctype.h>", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, + { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, @@ -20,7 +37,7 @@ { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, - { include: ["", "private", "", "public"] }, + { include: ["", "public", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, @@ -51,7 +68,6 @@ { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, - { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, @@ -61,7 +77,7 @@ { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, - { include: ["", "private", "", "public"] }, + { include: ["", "public", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, @@ -70,22 +86,30 @@ { include: ["<__mutex_base>", "private", "", "public"] }, { include: ["<__hash_table>", "private", "", "public"] }, { include: ["<__hash_table>", "private", "", "public"] }, -# { include: ["<>", "private", "<>", "public"] }, - + { include: ['"../common.h"', "public", '"common.h"', "public"] }, + # We provide our own assert. including assert.h/cassert spoils it and redefines the macro + { symbol: ["assert", "private", '"common.h"', "public"] }, + { symbol: ["assert", "private", '"../common.h"', "public"] }, + { symbol: ["wcstring", "private", '"common.h"', "public"] }, + { symbol: ["wcstring", "private", '"../common.h"', "public"] }, + { symbol: ["wcstring_list_t", "private", '"common.h"', "public"] }, + { symbol: ["wcstring_list_t", "private", '"../common.h"', "public"] }, + { symbol: ["wcstring", "private", '"flog.h"', "public"] }, + { symbol: ["wcstring_list_t", "private", '"flog.h"', "public"] }, { symbol: ["size_t", "private", "", "public"] }, { symbol: ["mutex", "private", "", "public"] }, { symbol: ["sig_atomic_t", "private", "", "public"] }, { symbol: ["va_end", "private", "", "public"] }, { symbol: ["va_list", "private", "", "public"] }, { symbol: ["va_start", "private", "", "public"] }, - { symbol: ["NULL", "private", "", "public"] }, + { symbol: ["NULL", "private", "", "public"] }, { symbol: ["NULL", "private", "", "public"] }, { symbol: ["NULL", "private", "", "public"] }, { symbol: ["NULL", "private", "", "public"] }, { symbol: ["off_t", "private", "", "public"] }, { symbol: ["off_t", "private", "", "public"] }, - { symbol: ["size_t", "private", "", "public"] }, - { symbol: ["ssize_t", "private", "", "public"] }, + { symbol: ["size_t", "private", "", "public"] }, + { symbol: ["ssize_t", "private", "", "public"] }, { symbol: ["intptr_t", "private", "", "public"] }, { symbol: ["gid_t", "private", "", "public"] }, { symbol: ["uid_t", "private", "", "public"] }, @@ -94,16 +118,54 @@ { symbol: ["uid_t", "private", "", "public"] }, { symbol: ["gid_t", "private", "", "public"] }, { symbol: ["timeval", "private", "", "public"] }, - { symbol: ["__uint32_t", "private", "", "public"] }, - { symbol: ["uint32_t", "private", "", "public"] }, - { symbol: ["intptr_t", "private", "", "public"] }, + { symbol: ["__uint32_t", "private", "", "public"] }, + { symbol: ["uint32_t", "private", "", "public"] }, + { symbol: ["intptr_t", "private", "", "public"] }, { symbol: ["tparm", "private", "", "public"] }, - { symbol: ["tigetflag", "private", "", "public"] }, - { symbol: ["ERR", "private", "", "public"] }, - { symbol: ["OK", "private", "", "public"] }, { symbol: ["select", "private", "", "public"] }, - { symbol: ["_LIBCPP_VERSION", "private", "", "public"] }, + { symbol: ["_LIBCPP_VERSION", "private", "", "public"] }, { symbol: ["_LIBCPP_VERSION", "private", "", "public"] }, - { symbol: ["MB_CUR_MAX", "private", "", "public"] }, - { symbol: ["MB_CUR_MAX", "private", "", "public"] }, + { symbol: ["MB_CUR_MAX", "private", "", "public"] }, + { symbol: ["MB_LEN_MAX", "private", "", "public"] }, + { symbol: ["WEOF", "private", "", "public"] }, + { symbol: [ "std::declval", private, "", public ] }, + { symbol: [ "std::forward", private, "", public ] }, + { symbol: [ "std::move", private, "", public ] }, + { symbol: [ "std::nullptr_t", private, "", public ] }, + { symbol: [ "std::string", private, "", public ] }, + { symbol: [ "std::isalnum", private, "", public ] }, + { symbol: [ "std::toupper", private, "", public ] }, + { symbol: [ "sem_t", private, "", public ] }, + { symbol: [ "sem_post", private, "", public ] }, + { symbol: [ "sem_wait", private, "", public ] }, + { symbol: [ "sem_init", private, "", public ] }, + { symbol: [ "sem_destroy", private, "", public ] }, + { symbol: [ "FD_SETSIZE", private, "", public ] }, + { symbol: [ "locale_t", private, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "<_xlocale.h>", private, "", public ] }, + ]