[Lldb-commits] [lldb] c88e298 - [lldb] Surpress "bitfield too small" gcc warning

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 10 04:40:24 PST 2020


Author: Pavel Labath
Date: 2020-01-10T13:43:05+01:00
New Revision: c88e298b69409e35e35ab601592197f5a2bc1c30

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

LOG: [lldb] Surpress "bitfield too small" gcc warning

Gcc produces this (technically correct) warning when storing an
explicitly-sized enum in a bitfield. Surpress that by changing the type
of the bitfield to an integer. The same approach is used elsewhere in
llvm (e.g. 56b5eab12).

Added: 
    

Modified: 
    lldb/include/lldb/Symbol/DebugMacros.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Symbol/DebugMacros.h b/lldb/include/lldb/Symbol/DebugMacros.h
index 55e651961257..da46c8b23c1d 100644
--- a/lldb/include/lldb/Symbol/DebugMacros.h
+++ b/lldb/include/lldb/Symbol/DebugMacros.h
@@ -23,7 +23,7 @@ typedef std::shared_ptr<DebugMacros> DebugMacrosSP;
 
 class DebugMacroEntry {
 public:
-  enum EntryType : uint32_t {
+  enum EntryType : uint8_t {
       INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT
   };
 
@@ -44,7 +44,7 @@ class DebugMacroEntry {
 
   ~DebugMacroEntry() = default;
 
-  EntryType GetType() const { return m_type; }
+  EntryType GetType() const { return static_cast<EntryType>(m_type); }
 
   uint64_t GetLineNumber() const { return m_line; }
 
@@ -62,7 +62,7 @@ class DebugMacroEntry {
 
   DebugMacroEntry(EntryType type, const DebugMacrosSP &debug_macros_sp);
 
-  EntryType m_type : 3;
+  uint32_t m_type : 3;
   uint32_t m_line : 29;
   uint32_t m_debug_line_file_idx;
   ConstString m_str;


        


More information about the lldb-commits mailing list