This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Introduce and use disassembly_flags


On 2017-02-13 15:02, Luis Machado wrote:
On 02/10/2017 09:12 PM, Simon Marchi wrote:
diff --git a/gdb/disasm.h b/gdb/disasm.h
index 42c1f3af6d..bb7a7a0d5c 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -21,13 +21,17 @@

 #include "dis-asm.h"

-#define DISASSEMBLY_SOURCE_DEPRECATED (0x1 << 0)
-#define DISASSEMBLY_RAW_INSN	(0x1 << 1)
-#define DISASSEMBLY_OMIT_FNAME	(0x1 << 2)
-#define DISASSEMBLY_FILENAME	(0x1 << 3)
-#define DISASSEMBLY_OMIT_PC	(0x1 << 4)
-#define DISASSEMBLY_SOURCE	(0x1 << 5)
-#define DISASSEMBLY_SPECULATIVE	(0x1 << 6)
+enum disassembly_flag {
+  DISASSEMBLY_SOURCE_DEPRECATED = (1 << 0),
+  DISASSEMBLY_RAW_INSN = (1 << 1),
+  DISASSEMBLY_OMIT_FNAME = (1 << 2),
+  DISASSEMBLY_FILENAME = (1 << 3),
+  DISASSEMBLY_OMIT_PC = (1 << 4),
+  DISASSEMBLY_SOURCE = (1 << 5),
+  DISASSEMBLY_SPECULATIVE = (1 << 6),
+};

Since we're touching this already, wouldn't it be slightly better to
have all of the above in lowercase instead of uppercase? They look
like #defined-ed constants otherwise.

I didn't check all of them, but it looks like other enums used for flags are upper case.

Also, should we consider converting DISASSEMBLY_SOURCE_DEPRECATED or
should we let it go? It was introduced in 2015.

What do you mean by "converting"?

Otherwise looks good to me.

Thanks,

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]