VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma as C-style comment

In commit 6942234bf5 (VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma:
associated to verification file, 2022-10-07, v3.25.0-rc1~22^2) the
comment was added as a C++-style comment.  The feature works in C too,
so use a C-style comment.
This commit is contained in:
ClausKlein
2024-04-07 10:29:26 +02:00
committed by Brad King
parent 01829f4715
commit b0773aa4f6
2 changed files with 3 additions and 2 deletions

View File

@@ -9194,7 +9194,8 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
// consider the headerFile as part of the entire language
// unit within include-what-you-use and as a result allows
// one to get IWYU advice for headers.
fout << "#include <" << headerFilename << "> // IWYU pragma: associated\n";
fout << "#include <" << headerFilename
<< "> /* IWYU pragma: associated */\n";
fout.close();
return filename;

View File

@@ -9,7 +9,7 @@ function(check_file target filename)
if(filename MATCHES "^(.*)(\\.[a-z]+)$")
set(header_filename "${CMAKE_MATCH_1}")
endif()
set(expected_contents "#include <${header_filename}> // IWYU pragma: associated\n")
set(expected_contents "#include <${header_filename}> /* IWYU pragma: associated */\n")
file(READ "${full_filename}" actual_contents)
if(NOT actual_contents STREQUAL expected_contents)