Skip to content

[flang] Fix warning in build #100134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024
Merged

[flang] Fix warning in build #100134

merged 1 commit into from
Jul 23, 2024

Conversation

psteinfeld
Copy link
Contributor

After tblah's update #99817, I'm getting a warning about an unusedvariable. It looks to me like the warning is bogus, possibly due to a bug in the compiler I'm using (GCC 9.3.0). But adding a "maybe_unused" clause fixes it and makes my builds clean.

variable.  It looks to me like the warning is bogus, possibly due to a
bug in the compiler I'm using (GCC 9.3.0).  But adding a "maybe_unused"
clause fixes it and makes my builds clean.
@psteinfeld psteinfeld requested review from tblah and klausler July 23, 2024 14:48
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Jul 23, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

@llvm/pr-subscribers-flang-fir-hlfir

Author: Pete Steinfeld (psteinfeld)

Changes

After tblah's update #99817, I'm getting a warning about an unusedvariable. It looks to me like the warning is bogus, possibly due to a bug in the compiler I'm using (GCC 9.3.0). But adding a "maybe_unused" clause fixes it and makes my builds clean.


Full diff: https://github.com/llvm/llvm-project/pull/100134.diff

1 Files Affected:

  • (modified) flang/lib/Lower/DirectivesCommon.h (+2-1)
diff --git a/flang/lib/Lower/DirectivesCommon.h b/flang/lib/Lower/DirectivesCommon.h
index 5b8d1f2359c5b..24cb7c2fcf7db 100644
--- a/flang/lib/Lower/DirectivesCommon.h
+++ b/flang/lib/Lower/DirectivesCommon.h
@@ -137,7 +137,8 @@ static inline void genOmpAtomicHintAndMemoryOrderClauses(
 }
 
 template <typename AtomicListT>
-static void processOmpAtomicTODO(mlir::Type elementType, mlir::Location loc) {
+static void processOmpAtomicTODO(mlir::Type elementType,
+                                 [[maybe_unused]] mlir::Location loc) {
   if (!elementType)
     return;
   if constexpr (std::is_same<AtomicListT,

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@psteinfeld psteinfeld merged commit 6a8c5a9 into llvm:main Jul 23, 2024
10 checks passed
@psteinfeld psteinfeld deleted the ps-fix-warning branch July 23, 2024 18:03
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
After tblah's update #99817, I'm getting a warning about an
unusedvariable. It looks to me like the warning is bogus, possibly due
to a bug in the compiler I'm using (GCC 9.3.0). But adding a
"maybe_unused" clause fixes it and makes my builds clean.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants