Hello community, here is the log from the commit of package include-what-you-use for openSUSE:Leap:15.2 checked in at 2020-06-01 19:40:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/include-what-you-use (Old) and /work/SRC/openSUSE:Leap:15.2/.include-what-you-use.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "include-what-you-use" Mon Jun 1 19:40:28 2020 rev:18 rq:750647 version:0.13 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/include-what-you-use/include-what-you-use.changes 2020-01-15 15:12:11.546132976 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.include-what-you-use.new.3606/include-what-you-use.changes 2020-06-01 19:40:28.668088103 +0200 @@ -1,0 +2,50 @@ +Sat Nov 16 20:32:01 UTC 2019 - Aaron Puchert <aaronpuch...@alice-dsl.net> + +- Deactivate ThinLTO on ARM: there are internal linker errors. + +------------------------------------------------------------------- +Sat Nov 2 22:57:53 UTC 2019 - Aaron Puchert <aaronpuch...@alice-dsl.net> + +- Update to version 0.13, update LLVM/Clang to version 9. + * Improved handling of relative includes in mappings and pragmas + * Path normalization now collapses .. + * Improve --no_fwd_decls not to remove required forward declarations + * Improved handling of builtin templates + * Don't mark forward declarations final + * Tolerate using declarations in precompiled header + * Add script to generate Qt mappings, and new mappings for Qt 5.11 + * Use directory from compilation database if available + * Numerous documentation and build improvements +- Add section about pragma comments to man page. +- Add link-llvm9.patch to adapt to packaging changes in LLVM. +- Enable ThinLTO where possible. +- Drop support for SLE12. + +------------------------------------------------------------------- +Tue Jul 9 10:19:25 UTC 2019 - Aaron Puchert <aaronpuch...@alice-dsl.net> + +- Disable LTO, because -flto=<number> doesn't work with Clang. + +------------------------------------------------------------------- +Sun May 26 19:41:55 UTC 2019 - aaronpuch...@alice-dsl.net + +- Update to version 0.12, update LLVM/Clang to version 8. + * New command-line option: --keep to mirror IWYU pragma: keep + * New command-line option: --cxx17ns to suggest compact C++17 + nested namespaces + * Improve --no_fwd_decls to optimize for minimal number of + redeclarations + * Improved mappings for POSIX types and let mappings apply to + builtins as well + * More principled handling of explicit template instantiations + * Breaking change in iwyu_tool: extra args are no longer + automatically prefixed with -Xiwyu (so you can use them for + Clang args too) + * Better handling of template forward-decls in fix_includes. +- Run test suite in %check. +- Package license file and documentation. +- Remove unnecessary %defattr. +- Update man page. +- Rebase fix-shebang.patch. + +------------------------------------------------------------------- Old: ---- include-what-you-use-0.11.src.tar.gz include-what-you-use.1.gz New: ---- include-what-you-use-0.13.src.tar.gz include-what-you-use.1 link-llvm9.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ include-what-you-use.spec ++++++ --- /var/tmp/diff_new_pack.gZWgDe/_old 2020-06-01 19:40:29.092089459 +0200 +++ /var/tmp/diff_new_pack.gZWgDe/_new 2020-06-01 19:40:29.092089459 +0200 @@ -1,8 +1,8 @@ # # spec file for package include-what-you-use # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. -# Copyright (c) 2018 Aaron Puchert. +# Copyright (c) 2019 SUSE LLC. +# Copyright (c) 2019 Aaron Puchert. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,25 +18,24 @@ Name: include-what-you-use -Version: 0.11 +Version: 0.13 Release: 0 Summary: A tool to analyze #includes in C and C++ source files License: NCSA Group: Development/Languages/C and C++ -Url: https://include-what-you-use.org/ +URL: https://include-what-you-use.org/ Source0: https://include-what-you-use.org/downloads/%{name}-%{version}.src.tar.gz -Source1: %{name}.1.gz +Source1: %{name}.1 Patch1: fix-shebang.patch Patch2: iwyu_include_picker.patch Patch3: remove-x86-specific-code.patch -BuildRequires: clang7 -BuildRequires: clang7-devel +Patch4: link-llvm9.patch +BuildRequires: clang9 +BuildRequires: clang9-devel BuildRequires: cmake -%if 0%{?sle_version} && 0%{?sle_version} <= 130000 && !0%{?is_opensuse} -BuildRequires: gcc6 -BuildRequires: gcc6-c++ -%endif -BuildRequires: llvm7-devel +BuildRequires: libstdc++-devel +BuildRequires: llvm9-devel +BuildRequires: python BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -67,38 +66,74 @@ %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %build +# Make _lto_cflags compatible with Clang, deactivate LTO where it doesn't work. +%ifnarch %{arm} +%define _lto_cflags "-flto=thin" +%else +%define _lto_cflags %{nil} +%endif + # Remove obsolete files - this is now hardcoded into iwyu_include_picker.cc. rm gcc.libc.imp gcc.symbols.imp gcc.stl.headers.imp stl.c.headers.imp -# The includes from third_party.imp probably only make sense in some code bases. -rm third_party.imp # This also obsoletes iwyu.gcc.imp. rm iwyu.gcc.imp -# Since Clang is built using Clang, use it here too. Except for SLES, where we -# need to use GCC 6 for some reason. (Otherwise there are segfaults.) -%if 0%{?sle_version} && 0%{?sle_version} <= 130000 && !0%{?is_opensuse} -export CC=gcc-6 CXX=g++-6 -%else -export CC=clang CXX=clang++ -%endif -%cmake -DIWYU_LLVM_ROOT_PATH=%{_libdir} .. +# Since Clang is built using Clang, use it here too. +%cmake \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_AR=%{_bindir}/llvm-ar \ + -DCMAKE_RANLIB=%{_bindir}/llvm-ranlib \ + -DIWYU_LLVM_ROOT_PATH=%{_libdir} \ + .. + +# ThinLTO uses multiple threads from the linker process for optimizations, which +# causes an extremely high lock contention on allocations due to MALLOC_CHECK_, +# so we deactivate it for compilation. The tests will have it activated again. +MALLOC_CHECK_BACK=$MALLOC_CHECK_ +unset MALLOC_CHECK_ %make_jobs +MALLOC_CHECK_=$MALLOC_CHECK_BACK %install %cmake_install -install -Dm0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1.gz +install -Dm0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1 + +%check +# We don't support MS style inline assembly, because we removed the dependency +# on the X86 target of LLVM. +rm tests/cxx/ms_inline_asm.cc + +# Test doesn't work on ARM. +%ifarch %arm +rm tests/cxx/badinc.cc +%endif + +# IWYU needs to find Clang's builtin headers. It looks for them relative to the +# binary (https://clang.llvm.org/docs/LibTooling.html#builtin-includes), but +# since it isn't installed into /usr/bin, it fails to find them. So we pass +# the directory manually to the executable, and because the test driver doesn't +# allow us to specify additional flags, we build a stub. +# Note that this isn't a problem for the installed package, because it will be +# in the same directory as the Clang binary. +export CLANG_BUILTIN_DIR=%{_libdir}/clang/%{_llvm_relver}/include +echo -e "#!/bin/bash\\nbuild/bin/include-what-you-use -isystem ${CLANG_BUILTIN_DIR} \$@" >iwyu-stub +chmod +x iwyu-stub +# We suppress stdout because it's pretty noisy. Failures are written to stderr. +./run_iwyu_tests.py -- ./iwyu-stub >/dev/null %files -%defattr(-, root, root, -) +%license LICENSE.TXT +%doc docs/* %{_bindir}/%{name} -%{_mandir}/man1/%{name}.1.gz +%{_mandir}/man1/%{name}.1%{ext_man} %{_datadir}/%{name}/ %files tools -%defattr(-, root, root, -) %{_bindir}/*.py %changelog ++++++ fix-shebang.patch ++++++ --- /var/tmp/diff_new_pack.gZWgDe/_old 2020-06-01 19:40:29.108089510 +0200 +++ /var/tmp/diff_new_pack.gZWgDe/_new 2020-06-01 19:40:29.108089510 +0200 @@ -15,6 +15,6 @@ @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python + """ Driver to consume a Clang compilation database and invoke IWYU. - from __future__ import print_function - + Example usage with CMake: ++++++ include-what-you-use-0.11.src.tar.gz -> include-what-you-use-0.13.src.tar.gz ++++++ ++++ 11327 lines of diff (skipped) ++++++ include-what-you-use.1 ++++++ --- /var/tmp/diff_new_pack.gZWgDe/_old 2020-06-01 19:40:29.316090175 +0200 +++ /var/tmp/diff_new_pack.gZWgDe/_new 2020-06-01 19:40:29.316090175 +0200 @@ -1,96 +1,95 @@ .\" t -*- coding: UTF-8 -*- .\" Man page for include-what-you-use .\" -.\" Copyright (C) 2018 Aaron Puchert based on the built-in documentation. +.\" Copyright (C) 2019 Aaron Puchert based on the built-in documentation. .\" -.\" You may distribute under the terms of the GNU General Public -.\" License as specified in the file COPYING that comes with the -.\" man-db distribution. +.\" You may distribute under the terms of the University of Illinois/ +.\" NCSA Open Source License as specified in the file LICENSE.TXT that +.\" comes with the software. .\" -.TH include-what-you-use 1 "2018-05-08" include-what-you-use "User Manuals" +.TH INCLUDE-WHAT-YOU-USE 1 "2019-11-02" include-what-you-use "User Commands" .SH NAME -include-what-you-use \- Analyze includes in C and C++ source files. +include-what-you-use \- analyze includes in C and C++ source files. .SH SYNOPSIS -.B include-what-you-use -.RB [ -Xiwyu -.IR option ]... -.RI [ clang-options ] -.I file +.SY include-what-you-use +.RB [ \-Xiwyu +.IR option "]\&.\|.\|. [" clang-options "] " file +.YS .SH DESCRIPTION -`Include what you use' means this: for every symbol (type, function variable, -or macro) that you use in +\(lqInclude what you use\(rq means this: for every symbol (type, function, +variable, or macro) that you use in .IR foo.cpp , either .IR foo.cpp " or " foo.h should include a header file that exports the declaration of that symbol. .B include-what-you-use -is a tool to analyze includes of source files to find `include-what-you-use' -violations, and suggest fixes for them. +is a tool to analyze includes of source files to find +\(lqinclude-what-you-use\(rq violations, and suggest fixes for them. .PP The main goal of .B include-what-you-use -is to remove superfluous includes. It does this both by figuring out what -includes are not actually needed for this file (for both source and header -files), and by replacing includes with forward declarations when possible. +is to remove superfluous includes. +It does this both by figuring out what includes are not actually needed for this +file (for both source and header files), and by replacing includes with forward +declarations when possible. .SH OPTIONS Options for .B include-what-you-use have to be preceded with -.BR -Xiwyu . +.BR \-Xiwyu . All other options are interpreted as .BR clang (1) compiler options. .TP -.BI --check_also= glob -Print `include-what-you-use'-violation info for all files matching the given -glob pattern (in addition to the default of reporting for the input source file -and associated header files). +.BI \-\-check_also= glob +Print \(lqinclude-what-you-use\(rq-violation info for all files matching the +given glob pattern (in addition to the default of reporting for the input +source file and associated header files). This flag may be specified multiple times to specify multiple glob patterns. .TP -.BI --cwd= dir -Set current working directory. +.B \-\-cxx17ns +Suggest the more concise syntax for nested namespaces introduced in C++17. .TP -.BR --howtodebug [ =\fIfilename ] -Without argument, prints instructions on how to run -.B include-what-you-use -under -.BR gdb (1) -for the input file, and exits. With argument, prints only when input file -matches the argument. +.BI \-\-keep= glob +Always keep the includes matched by +.IR glob . +This flag may be used multiple times to specify more than one glob pattern. .TP -.BI --mapping_file= filename +.BI \-\-mapping_file= filename Use the given mapping file. .TP -.B --max_line_length +.B \-\-max_line_length Maximum line length for includes. Note that this only affects the comments and their alignment, the maximum line length can still be exceeded with long filenames (default: 80). .TP -.B --no_comments +.B \-\-no_comments Do not add comments after includes about which symbols the header was required for. .TP -.B --no_default_mappings +.B \-\-no_default_mappings Do not use the default mappings. .TP -.B --no_fwd_decls +.B \-\-no_fwd_decls Do not use forward declarations, and instead always include the required header. .TP -.B --pch_in_code +.B \-\-pch_in_code Mark the first include in a translation unit as a precompiled header. Use -.B --pch_in_code +.B \-\-pch_in_code to prevent removal of necessary PCH includes. Although .BR clang (1) forces PCHs to be listed as prefix headers, the PCH-in-code pattern can be used with .BR gcc (1). .TP -.BI --prefix_header_includes= value +.BI \-\-prefix_header_includes= value Controls how includes and forward declarations involving prefix headers should -be handled. Prefix headers are files included via the command-line option +be handled. +Prefix headers are files included via the command-line option .BR -include . This option specifies what to do if a prefix header makes includes or forward -declarations obsolete. The following +declarations obsolete. +The following .IR value s are allowed: .RS @@ -105,27 +104,28 @@ No new includes are added, existing ones are removed. .RE .TP -.B --quoted_includes_first -When sorting includes, place quoted ones first. +.B \-\-quoted_includes_first +When sorting includes, place quoted includes first. .TP -.B --transitive_includes_only +.B \-\-transitive_includes_only Do not suggest that a file should add .IR foo.h " unless " foo.h is already visible in the file's transitive includes. .TP -.BI --verbose= level +.BI \-\-verbose= level Set verbosity. At the highest level, this will dump the AST of the source file and explain all decisions. .SH EXIT STATUS .B include-what-you-use -always returns with an error to make usage with +always returns with a nonzero status code to make usage with .BR make (1) feasible. .SH MAPPING FILES -Sometimes headers are not meant to be included directly, and sometimes headers -are guaranteed to include other headers. Since this is hard to tell from the -source code alone, these relationships have to be provided via mapping files. - +Sometimes headers are not meant to be included directly, +and sometimes headers are guaranteed to include other headers. +Since this is hard to tell from the source code alone, +these relationships have to be provided via mapping files or pragma comments. +.PP A mapping file consists of a comma-separated list of rules enclosed by square brackets .BR [] . @@ -134,8 +134,9 @@ .BI "{ include: [" header ", " header "] }" Declares that instead of the first .I header -the second can be used. A header can appear on the left-hand side in multiple -rules, meaning that any of the right-hand side headers can be used instead. +the second can be used. +A header can appear on the left-hand side in multiple rules, +meaning that any of the right-hand side headers can be used instead. .TP .BI "{ symbol: [" symbol ", " header "] }" Declares that to use a @@ -157,8 +158,9 @@ .I visibility specifies whether the header is .BR public " or " private . -Private headers are not allowed to be included directly. So every private -header file should appear on the left-hand side of a mapping at least once. +Private headers are not allowed to be included directly. +So every private header file should appear on the left-hand side of a mapping +at least once. The visibility of a header file has to be the same for all rules it appears in! .TP .IB "include-spec\fR := " < system-header-file > \ @@ -166,6 +168,7 @@ How the header is .BR #include d in a source file. +Quotation marks need to be escaped. .TP .IB "symbol\fR := " \(dq symbol-name "\(dq, " visibility Describes a symbol, for example a type, function or macro. The @@ -177,6 +180,58 @@ Lines starting with .B # are treated as comments. +.SH PRAGMA COMMENTS +Pragma comments provide information about the relations between source and +header files and allow to whitelist or blacklist +.BR #include s +and forward declarations. +.PP +All arguments should be enclosed in quotation marks. +.TP +.B // IWYU pragma: keep +Used after +.B #include +directives or forward declarations it ensures that they won't be removed. +.TP +.B // IWYU pragma: export +Used after an +.B #include +directive it indicates that the current file is considered to be a provider of +the included file. +.TP +.BR "// IWYU pragma: begin_exports" , " // IWYU pragma: end_exports" +Has the same effect as the previous pragma comment, but applies to a range of +.BR #include s +instead of a single line. +.TP +.BR "// IWYU pragma: private" [ ", include \fIheader" ] +Indicates that the current file is considered private, +and (optionally) that any symbol will be provided by +.IR header . +.TP +.BI "// IWYU pragma: no_include " header +States that +.I header +should not be suggested for inclusion. +.TP +.BI "// IWYU pragma: no_forward_declare "symbol +States that +.I symbol +should not be forward-declared. +.TP +.BI "// IWYU pragma: friend " regex +Used in a private header, this indicates that all files matching +.I regex +are allowed to +.B #include +it. +.TP +.B // IWYU pragma: associated +Used in a source file after an +.B #include +directive, this marks the header as associated to the source file. +This is required if source and header filename differ in more than their ending. +Includes from an associated header are assumed in the source file. .SH FILES .I /usr/share/include-what-you-use .RS @@ -194,7 +249,7 @@ .PP .RS .EX -make -k CC=include-what-you-use CXX=include-what-you-use +make \-k CC=include-what-you-use CXX=include-what-you-use .EE .RE .PP @@ -203,11 +258,11 @@ .BR -k . It only analyzes source files built by .BR make (1) -along with their corresponding header files. If a project has a header file -with no corresponding source file, +along with their corresponding header files. +If a project has a header file with no corresponding source file, .B include-what-you-use will ignore it unless you use the -.B --check_also +.B \-\-check_also option to add it for analysis together with a source file. .PP CMake has built-in support for @@ -218,7 +273,7 @@ .PP .RS .EX -cmake -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use <args>" .. +cmake \-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use <args>" .. .EE .RE .PP ++++++ link-llvm9.patch ++++++ >From 589cf3836ed663b1386ed071e446d8da0fc3ef4b Mon Sep 17 00:00:00 2001 From: Aaron Puchert <aaronpuch...@alice-dsl.net> Date: Fri, 1 Nov 2019 17:23:54 +0100 Subject: [PATCH] Link with clang-cpp if only that is available Since LLVM 9, the Clang component libraries are also linked into clang-cpp, which provides the full C++ API [1]. So we link with that if it is available and the component libraries are not. [1] http://releases.llvm.org/9.0.0/tools/clang/docs/ReleaseNotes.html#build-system-changes --- CMakeLists.txt | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15c48cd..a4b02ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,25 +100,30 @@ if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /EHsc") endif() -target_link_libraries(include-what-you-use - PRIVATE - clangBasic - clangLex - clangAST - clangSema - clangFrontend - clangDriver - - # Revision [1] in clang moved PCHContainerOperations from Frontend - # to Serialization, but this broke builds that set - # -DBUILD_SHARED_LIBS=on. Revision [2] is a followup that works - # around the issue by adding an explicit dependency on Serialization - # wherever there was a dependency on Frontend. Since we depend on - # Frontend, we need an explicit dependency on Serialization too. - # [1] https://llvm.org/viewvc/llvm-project?view=revision&revision=348907 - # [2] https://llvm.org/viewvc/llvm-project?view=revision&revision=348915 - clangSerialization - ) +# If only clang-cpp is available, we take that. +if (TARGET clang-cpp AND NOT TARGET clangBasic) + target_link_libraries(include-what-you-use PRIVATE clang-cpp) +else() + target_link_libraries(include-what-you-use + PRIVATE + clangBasic + clangLex + clangAST + clangSema + clangFrontend + clangDriver + + # Revision [1] in clang moved PCHContainerOperations from Frontend + # to Serialization, but this broke builds that set + # -DBUILD_SHARED_LIBS=on. Revision [2] is a followup that works + # around the issue by adding an explicit dependency on Serialization + # wherever there was a dependency on Frontend. Since we depend on + # Frontend, we need an explicit dependency on Serialization too. + # [1] https://llvm.org/viewvc/llvm-project?view=revision&revision=348907 + # [2] https://llvm.org/viewvc/llvm-project?view=revision&revision=348915 + clangSerialization + ) +endif() # Platform dependencies. if (WIN32) -- 2.23.0