| 
     
      
      
      From: <no...@tc...> - 2025-10-24 16:18:40
      
     
   | 
Automated mail by fx, on behalf of no...@tc... Ticket Change [6654efac69c9d4cc90f2ff95d1751e837881f01ba7a9eb0c27884b72bfffda4e] [Add IWYU export pragma annotations for improved clangd and clang-tidy diagnostics] By hzeller For Tcl On 2025-10-24T16:16:13.659 Details https://core.tcl-lang.org/tcl/tinfo?name=6654efac69c9d4cc90f2ff95d1751e837881f01ba7a9eb0c27884b72bfffda4e Ticket https://core.tcl-lang.org/tcl/tktview/c7dc599e73a7094298594c4383ad3524f009e6f8 Changed Fields assignee: nobody closer: nobody comment: Someone including the toplevel "tcl.h" header might get misc-include-cleaner warnings from the clangd language server and clang-tidy in their projects for some symbols that are only provided by the "tclDecls.h" or "tclPlatDecls.h" headers as they are not _directly_ included. The annotation with IWYU pragmas fixes that and tells the tools that it should consider that these includes indeed should be considered as exporting the symbols and thus as if they directly provided the symbol Documentation clangd and clang-tidy https://clang.llvm.org/extra/clang-tidy/checks/misc/include-cleaner.ht ml points to https://clangd.llvm.org/design/include-cleaner#iwyu-pragmas This has been first implemented and docuemnted in the include-what-you-use project https://github.com/include-what-you-use/include-what-you-use/blob/mast er/docs/IWYUPragmas.md#iwyu-pragma-begin_exportsend_exports === 8< === Patch ==== --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2343,7 +2343,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv); * table. */ -#include "tclDecls.h" +#include "tclDecls.h" /* IWYU pragma: export */ /* * Include platform specific public function declarations that are accessible @@ -2356,7 +2356,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv); # define TCLAPI MODULE_SCOPE #endif -#include "tclPlatDecls.h" +#include "tclPlatDecls.h" /* IWYU pragma: export */ /* *--------------------------------------------------------------------- ------- foundin: head is_private: 0 login: hzeller priority: 5 Medium private_contact: 9bef9914fb30c8aedb6cfa0bafc4b43d058d4e85 resolution: None severity: Minor status: Open submitter: hzeller subsystem: None title: Add IWYU export pragma annotations for improved clangd and clang-tidy diagnostics type: Patch ------------------------------------------------------------ See Tcl/Tk development @ http://core.tcl-lang.org/ ------------------------------------------------------------  |