[clang] 2583221 - Fix compile error in UnresolvedSetTest.cpp with -Wall

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 09:43:07 PDT 2023


Author: John Brawn
Date: 2023-07-05T17:39:59+01:00
New Revision: 258322105892bd895a89ccbe89487885581f5a47

URL: https://github.com/llvm/llvm-project/commit/258322105892bd895a89ccbe89487885581f5a47
DIFF: https://github.com/llvm/llvm-project/commit/258322105892bd895a89ccbe89487885581f5a47.diff

LOG: Fix compile error in UnresolvedSetTest.cpp with -Wall

A stage 2 buildbot that compiles with -Wall -Werror is showing a failure because
a dummy value is unused. Use the unused attribute to suppress the warning, and
add a comment about why we have this value.

Added: 
    

Modified: 
    clang/unittests/AST/UnresolvedSetTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/AST/UnresolvedSetTest.cpp b/clang/unittests/AST/UnresolvedSetTest.cpp
index 6c4d6db9092321..147c42e1fb0884 100644
--- a/clang/unittests/AST/UnresolvedSetTest.cpp
+++ b/clang/unittests/AST/UnresolvedSetTest.cpp
@@ -3,7 +3,9 @@
 
 namespace clang {
 class NamedDecl {
-  int dummy;
+  // DeclAccessPair assumes that NamedDecl is at least 4-byte aligned, so we
+  // we need to have a dummy value to make this dummy NamedDecl also be aligned.
+  int dummy __attribute__((unused));
 
 public:
   NamedDecl() {}


        


More information about the cfe-commits mailing list