mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 06:40:16 -05:00
Ninja: Revert "Exclude NVHPC -Werror flags during Fortran preprocessing"
Revert commit6b58cdd4cf(Ninja: Exclude NVHPC -Werror flags during Fortran preprocessing, 2023-04-04). Since commit9d40f01442(NVHPC: Use -Werror for COMPILE_OPTIONS_WARNING_AS_ERROR, 2023-04-13), `nvfortran` can handle the plain `-Werror` flag during preprocessing. Issue: #24665
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
include(Compiler/PGI-Fortran)
|
include(Compiler/PGI-Fortran)
|
||||||
include(Compiler/NVHPC)
|
include(Compiler/NVHPC)
|
||||||
__compiler_nvhpc(Fortran)
|
__compiler_nvhpc(Fortran)
|
||||||
set(CMAKE_Fortran_PREPROCESS_SOURCE_EXCLUDE_FLAGS_REGEX "(^| )-Werror([=,][a-z][a-z-]+)?( |$)")
|
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
#include <cm3p/json/value.h>
|
#include <cm3p/json/value.h>
|
||||||
#include <cm3p/json/writer.h>
|
#include <cm3p/json/writer.h>
|
||||||
|
|
||||||
#include "cmsys/RegularExpression.hxx"
|
|
||||||
|
|
||||||
#include "cmComputeLinkInformation.h"
|
#include "cmComputeLinkInformation.h"
|
||||||
#include "cmCustomCommandGenerator.h"
|
#include "cmCustomCommandGenerator.h"
|
||||||
#include "cmDyndepCollation.h"
|
#include "cmDyndepCollation.h"
|
||||||
@@ -1262,7 +1260,6 @@ namespace {
|
|||||||
cmNinjaBuild GetScanBuildStatement(const std::string& ruleName,
|
cmNinjaBuild GetScanBuildStatement(const std::string& ruleName,
|
||||||
const std::string& ppFileName,
|
const std::string& ppFileName,
|
||||||
bool compilePP, bool compilePPWithDefines,
|
bool compilePP, bool compilePPWithDefines,
|
||||||
cmValue ppExcludeFlagsRegex,
|
|
||||||
cmNinjaBuild& objBuild, cmNinjaVars& vars,
|
cmNinjaBuild& objBuild, cmNinjaVars& vars,
|
||||||
const std::string& objectFileName,
|
const std::string& objectFileName,
|
||||||
cmLocalGenerator* lg)
|
cmLocalGenerator* lg)
|
||||||
@@ -1291,20 +1288,6 @@ cmNinjaBuild GetScanBuildStatement(const std::string& ruleName,
|
|||||||
// Scanning and compilation generally use the same flags.
|
// Scanning and compilation generally use the same flags.
|
||||||
scanBuild.Variables["FLAGS"] = vars["FLAGS"];
|
scanBuild.Variables["FLAGS"] = vars["FLAGS"];
|
||||||
|
|
||||||
// Exclude flags not valid during preprocessing.
|
|
||||||
if (compilePP && !ppExcludeFlagsRegex.IsEmpty()) {
|
|
||||||
std::string in = std::move(scanBuild.Variables["FLAGS"]);
|
|
||||||
std::string out;
|
|
||||||
cmsys::RegularExpression regex(*ppExcludeFlagsRegex);
|
|
||||||
std::string::size_type pos = 0;
|
|
||||||
while (regex.find(in.c_str() + pos)) {
|
|
||||||
out = cmStrCat(out, in.substr(pos, regex.start()), ' ');
|
|
||||||
pos += regex.end();
|
|
||||||
}
|
|
||||||
out = cmStrCat(out, in.substr(pos));
|
|
||||||
scanBuild.Variables["FLAGS"] = std::move(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compilePP && !compilePPWithDefines) {
|
if (compilePP && !compilePPWithDefines) {
|
||||||
// Move preprocessor definitions to the scan/preprocessor build statement.
|
// Move preprocessor definitions to the scan/preprocessor build statement.
|
||||||
std::swap(scanBuild.Variables["DEFINES"], vars["DEFINES"]);
|
std::swap(scanBuild.Variables["DEFINES"], vars["DEFINES"]);
|
||||||
@@ -1529,22 +1512,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
|
|||||||
|
|
||||||
std::string scanRuleName;
|
std::string scanRuleName;
|
||||||
std::string ppFileName;
|
std::string ppFileName;
|
||||||
cmValue ppExcludeFlagsRegex;
|
|
||||||
if (compilePP) {
|
if (compilePP) {
|
||||||
scanRuleName = this->LanguagePreprocessAndScanRule(language, config);
|
scanRuleName = this->LanguagePreprocessAndScanRule(language, config);
|
||||||
ppFileName = this->ConvertToNinjaPath(
|
ppFileName = this->ConvertToNinjaPath(
|
||||||
this->GetPreprocessedFilePath(source, config));
|
this->GetPreprocessedFilePath(source, config));
|
||||||
ppExcludeFlagsRegex = this->Makefile->GetDefinition(cmStrCat(
|
|
||||||
"CMAKE_", language, "_PREPROCESS_SOURCE_EXCLUDE_FLAGS_REGEX"));
|
|
||||||
} else {
|
} else {
|
||||||
scanRuleName = this->LanguageScanRule(language, config);
|
scanRuleName = this->LanguageScanRule(language, config);
|
||||||
ppFileName = cmStrCat(objectFileName, ".ddi.i");
|
ppFileName = cmStrCat(objectFileName, ".ddi.i");
|
||||||
}
|
}
|
||||||
|
|
||||||
cmNinjaBuild ppBuild = GetScanBuildStatement(
|
cmNinjaBuild ppBuild = GetScanBuildStatement(
|
||||||
scanRuleName, ppFileName, compilePP, compilePPWithDefines,
|
scanRuleName, ppFileName, compilePP, compilePPWithDefines, objBuild,
|
||||||
ppExcludeFlagsRegex, objBuild, vars, objectFileName,
|
vars, objectFileName, this->LocalGenerator);
|
||||||
this->LocalGenerator);
|
|
||||||
|
|
||||||
if (compilePP) {
|
if (compilePP) {
|
||||||
// In case compilation requires flags that are incompatible with
|
// In case compilation requires flags that are incompatible with
|
||||||
|
|||||||
Reference in New Issue
Block a user