[flang-commits] [flang] d270d36 - [mlir][flang] Fix -Wunused-result after D146785 (NFC)
Jie Fu via flang-commits
flang-commits at lists.llvm.org
Sun Apr 2 01:31:12 PDT 2023
Author: Jie Fu
Date: 2023-04-02T16:30:33+08:00
New Revision: d270d3638b048dff8845c604a447180852c7edcf
URL: https://github.com/llvm/llvm-project/commit/d270d3638b048dff8845c604a447180852c7edcf
DIFF: https://github.com/llvm/llvm-project/commit/d270d3638b048dff8845c604a447180852c7edcf.diff
LOG: [mlir][flang] Fix -Wunused-result after D146785 (NFC)
/data/llvm-project/mlir/examples/toy/Ch4/toyc.cpp:119:5: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.
/data/llvm-project/flang/lib/Frontend/FrontendActions.cpp:669:3: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
mlir::applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.
Added:
Modified:
flang/lib/Frontend/FrontendActions.cpp
flang/tools/bbc/bbc.cpp
flang/tools/tco/tco.cpp
mlir/examples/toy/Ch3/toyc.cpp
mlir/examples/toy/Ch4/toyc.cpp
mlir/examples/toy/Ch5/toyc.cpp
mlir/examples/toy/Ch6/toyc.cpp
mlir/examples/toy/Ch7/toyc.cpp
Removed:
################################################################################
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index e09968cdf6b50..b2f25d1f56898 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -666,7 +666,7 @@ void CodeGenAction::generateLLVMIR() {
// Create the pass pipeline
fir::createMLIRToLLVMPassPipeline(pm, level, opts.StackArrays,
opts.Underscoring, opts.getDebugInfo());
- mlir::applyPassManagerCLOptions(pm);
+ (void)mlir::applyPassManagerCLOptions(pm);
// run the pass manager
if (!mlir::succeeded(pm.run(*mlirModule))) {
diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index a37bf61ed35a8..d021a96ab889a 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -260,7 +260,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
mlir::PassManager pm(mlirModule->getName(),
mlir::OpPassManager::Nesting::Implicit);
pm.enableVerifier(/*verifyPasses=*/true);
- mlir::applyPassManagerCLOptions(pm);
+ (void)mlir::applyPassManagerCLOptions(pm);
if (passPipeline.hasAnyOccurrences()) {
// run the command-line specified pipeline
(void)passPipeline.addToPipeline(pm, [&](const llvm::Twine &msg) {
diff --git a/flang/tools/tco/tco.cpp b/flang/tools/tco/tco.cpp
index e7dca6b06b27d..9552d5c9af9e3 100644
--- a/flang/tools/tco/tco.cpp
+++ b/flang/tools/tco/tco.cpp
@@ -106,7 +106,7 @@ compileFIR(const mlir::PassPipelineCLParser &passPipeline) {
mlir::PassManager pm((*owningRef)->getName(),
mlir::OpPassManager::Nesting::Implicit);
pm.enableVerifier(/*verifyPasses=*/true);
- mlir::applyPassManagerCLOptions(pm);
+ (void)mlir::applyPassManagerCLOptions(pm);
if (emitFir) {
// parse the input and pretty-print it back out
// -emit-fir intentionally disables all the passes
diff --git a/mlir/examples/toy/Ch3/toyc.cpp b/mlir/examples/toy/Ch3/toyc.cpp
index ef362e4af82f0..859791336ab2f 100644
--- a/mlir/examples/toy/Ch3/toyc.cpp
+++ b/mlir/examples/toy/Ch3/toyc.cpp
@@ -115,7 +115,7 @@ int dumpMLIR() {
if (enableOpt) {
mlir::PassManager pm(module.get()->getName());
// Apply any generic pass manager command line options and run the pipeline.
- applyPassManagerCLOptions(pm);
+ (void)applyPassManagerCLOptions(pm);
// Add a run of the canonicalizer to optimize the mlir module.
pm.addNestedPass<mlir::toy::FuncOp>(mlir::createCanonicalizerPass());
diff --git a/mlir/examples/toy/Ch4/toyc.cpp b/mlir/examples/toy/Ch4/toyc.cpp
index bf8e694000c7c..b866ffaeb62cb 100644
--- a/mlir/examples/toy/Ch4/toyc.cpp
+++ b/mlir/examples/toy/Ch4/toyc.cpp
@@ -116,7 +116,7 @@ int dumpMLIR() {
if (enableOpt) {
mlir::PassManager pm(module.get()->getName());
// Apply any generic pass manager command line options and run the pipeline.
- applyPassManagerCLOptions(pm);
+ (void)applyPassManagerCLOptions(pm);
// Inline all functions into main and then delete them.
pm.addPass(mlir::createInlinerPass());
diff --git a/mlir/examples/toy/Ch5/toyc.cpp b/mlir/examples/toy/Ch5/toyc.cpp
index 5a23c4981fea2..3cc2683c193ff 100644
--- a/mlir/examples/toy/Ch5/toyc.cpp
+++ b/mlir/examples/toy/Ch5/toyc.cpp
@@ -119,7 +119,7 @@ int dumpMLIR() {
mlir::PassManager pm(module.get()->getName());
// Apply any generic pass manager command line options and run the pipeline.
- applyPassManagerCLOptions(pm);
+ (void)applyPassManagerCLOptions(pm);
// Check to see what granularity of MLIR we are compiling to.
bool isLoweringToAffine = emitAction >= Action::DumpMLIRAffine;
diff --git a/mlir/examples/toy/Ch6/toyc.cpp b/mlir/examples/toy/Ch6/toyc.cpp
index 60b7da0850194..e637cf976c014 100644
--- a/mlir/examples/toy/Ch6/toyc.cpp
+++ b/mlir/examples/toy/Ch6/toyc.cpp
@@ -136,7 +136,7 @@ int loadAndProcessMLIR(mlir::MLIRContext &context,
mlir::PassManager pm(module.get()->getName());
// Apply any generic pass manager command line options and run the pipeline.
- applyPassManagerCLOptions(pm);
+ (void)applyPassManagerCLOptions(pm);
// Check to see what granularity of MLIR we are compiling to.
bool isLoweringToAffine = emitAction >= Action::DumpMLIRAffine;
diff --git a/mlir/examples/toy/Ch7/toyc.cpp b/mlir/examples/toy/Ch7/toyc.cpp
index f074bf68188af..c2effc7317c0f 100644
--- a/mlir/examples/toy/Ch7/toyc.cpp
+++ b/mlir/examples/toy/Ch7/toyc.cpp
@@ -136,7 +136,7 @@ int loadAndProcessMLIR(mlir::MLIRContext &context,
mlir::PassManager pm(module.get()->getName());
// Apply any generic pass manager command line options and run the pipeline.
- applyPassManagerCLOptions(pm);
+ (void)applyPassManagerCLOptions(pm);
// Check to see what granularity of MLIR we are compiling to.
bool isLoweringToAffine = emitAction >= Action::DumpMLIRAffine;
More information about the flang-commits
mailing list