Skip to contentSkip to conversation

Add -*- gdb-script -*- to the top of gdbhelpers, for Emacs

PATCH In review Samuel Bronson 3 participants 11 messages May 31, 2009 – Jun 1, 2009 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Add -*- gdb-script -*- to the top of gdbhelpers, for Emacs

Changes-licensed-under: ISC license

---
 gdbhelpers |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
gdbhelpers +1 -0
index 7223ffd..34407d6 100644
@@ -1,3 +1,4 @@
+# For emacs: -*- gdb-script -*- 
 
 # Don't forget to rebuild sparse with uncommented debug options
 # in the Makefile. Also, gcc 3 is known to screw up with the
Signature · 1 line
1.6.3.1.169.g33fd.dirty
#1 lore raw

PATCH 2/3 Replace SYM_ and MOD_ #defines with enums in symbol.h.

Adjust the associated fields to match. While we're here, change some nearby bitfields from "char" to "int" so GDB doesn't bother showing character literals for them.

This should allow the gdbhelpers script to work with more versions of GDB and/or build configurations.

Changes-licensed-under: ISC license

---
 symbol.h |  106 ++++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 56 insertions(+), 50 deletions(-)
symbol.h +56 -50
index c4d7f28..4a16f0d 100644
@@ -80,7 +80,7 @@ extern struct context *alloc_context(void);
 DECLARE_PTR_LIST(context_list, struct context);
 
 struct ctype {
-	unsigned long modifiers;
+	enum modifier modifiers;
 	unsigned long alignment;
 	struct context_list *contexts;
 	unsigned int as;
@@ -103,14 +103,19 @@ struct symbol_op {
 extern int expand_safe_p(struct expression *expr, int cost);
 extern int expand_constant_p(struct expression *expr, int cost);
 
-#define SYM_ATTR_WEAK		0
-#define SYM_ATTR_NORMAL		1
-#define SYM_ATTR_STRONG		2
+enum sym_attr {
+	SYM_ATTR_WEAK	= 0,
+	SYM_ATTR_NORMAL	= 1,
+	SYM_ATTR_STRONG	= 2,
+};
 
 struct symbol {
 	enum type type:8;
 	enum namespace namespace:9;
-	unsigned char used:1, attr:2, enum_member:1, bound:1;
+	unsigned int used:1;
+	enum sym_attr attr:2;
+	unsigned int enum_member:1;
+	unsigned int bound:1;
 	struct position pos;		/* Where this symbol was declared */
 	struct position endpos;		/* Where this symbol ends*/
 	struct ident *ident;		/* What identifier this symbol is associated with */
@@ -162,57 +167,58 @@ struct symbol {
 		void *aux;			/* Auxiliary info, e.g. backend information */
 		struct {			/* sparse ctags */
 			char kind;
-			unsigned char visited:1;
+			unsigned int visited:1;
 		};
 	};
 	pseudo_t pseudo;
 };
 
 /* Modifiers */
-#define MOD_AUTO	0x0001
-#define MOD_REGISTER	0x0002
-#define MOD_STATIC	0x0004
-#define MOD_EXTERN	0x0008
-
-#define MOD_CONST	0x0010
-#define MOD_VOLATILE	0x0020
-#define MOD_SIGNED	0x0040
-#define MOD_UNSIGNED	0x0080
-
-#define MOD_CHAR	0x0100
-#define MOD_SHORT	0x0200
-#define MOD_LONG	0x0400
-#define MOD_LONGLONG	0x0800
-
-#define MOD_TYPEDEF	0x1000
-
-#define MOD_INLINE	0x40000
-#define MOD_ADDRESSABLE	0x80000
-
-#define MOD_NOCAST	0x100000
-#define MOD_NODEREF	0x200000
-#define MOD_ACCESSED	0x400000
-#define MOD_TOPLEVEL	0x800000	// scoping..
-
-#define MOD_LABEL	0x1000000
-#define MOD_ASSIGNED	0x2000000
-#define MOD_TYPE	0x4000000
-#define MOD_SAFE	0x8000000	// non-null/non-trapping pointer
-
-#define MOD_USERTYPE	0x10000000
-#define MOD_FORCE	0x20000000
-#define MOD_EXPLICITLY_SIGNED	0x40000000
-#define MOD_BITWISE	0x80000000
-
-#define MOD_NONLOCAL	(MOD_EXTERN | MOD_TOPLEVEL)
-#define MOD_STORAGE	(MOD_AUTO | MOD_REGISTER | MOD_STATIC | MOD_EXTERN | MOD_INLINE | MOD_TOPLEVEL | MOD_FORCE)
-#define MOD_SIGNEDNESS	(MOD_SIGNED | MOD_UNSIGNED | MOD_EXPLICITLY_SIGNED)
-#define MOD_SPECIFIER	(MOD_CHAR | MOD_SHORT | MOD_LONG | MOD_LONGLONG | MOD_SIGNEDNESS)
-#define MOD_SIZE	(MOD_CHAR | MOD_SHORT | MOD_LONG | MOD_LONGLONG)
-#define MOD_IGNORE (MOD_TOPLEVEL | MOD_STORAGE | MOD_ADDRESSABLE |	\
-	MOD_ASSIGNED | MOD_USERTYPE | MOD_ACCESSED | MOD_EXPLICITLY_SIGNED)
-#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE)
-
+enum modifier {
+	MOD_AUTO	= 1 << 0,
+	MOD_REGISTER	= 1 << 1,
+	MOD_STATIC	= 1 << 2,
+	MOD_EXTERN	= 1 << 3,
+
+	MOD_CONST	= 1 << 4,
+	MOD_VOLATILE	= 1 << 5,
+	MOD_SIGNED	= 1 << 6,
+	MOD_UNSIGNED	= 1 << 7,
+
+	MOD_CHAR	= 1 << 8,
+	MOD_SHORT	= 1 << 9,
+	MOD_LONG	= 1 << 10,
+	MOD_LONGLONG	= 1 << 11,
+
+	MOD_TYPEDEF	= 1 << 12,
+
+	MOD_INLINE	= 1 << 18,
+	MOD_ADDRESSABLE	= 1 << 19,
+
+	MOD_NOCAST	= 1 << 20,
+	MOD_NODEREF	= 1 << 21,
+	MOD_ACCESSED	= 1 << 22,
+	MOD_TOPLEVEL	= 1 << 23,	// scoping..
+
+	MOD_LABEL	= 1 << 24,
+	MOD_ASSIGNED	= 1 << 25,
+	MOD_TYPE	= 1 << 26,
+	MOD_SAFE	= 1 << 27,	// non-null/non-trapping pointer
+
+	MOD_USERTYPE	= 1 << 28,
+	MOD_FORCE       = 1 << 29,
+	MOD_EXPLICITLY_SIGNED	= 1 << 30,
+	MOD_BITWISE	= 1 << 31,
+
+	MOD_NONLOCAL	= (MOD_EXTERN | MOD_TOPLEVEL),
+	MOD_STORAGE	= (MOD_AUTO | MOD_REGISTER | MOD_STATIC | MOD_EXTERN | MOD_INLINE | MOD_TOPLEVEL | MOD_FORCE),
+	MOD_SIGNEDNESS	= (MOD_SIGNED | MOD_UNSIGNED | MOD_EXPLICITLY_SIGNED),
+	MOD_SPECIFIER	= (MOD_CHAR | MOD_SHORT | MOD_LONG | MOD_LONGLONG | MOD_SIGNEDNESS),
+	MOD_SIZE	= (MOD_CHAR | MOD_SHORT | MOD_LONG | MOD_LONGLONG),
+	MOD_IGNORE	= (MOD_TOPLEVEL | MOD_STORAGE | MOD_ADDRESSABLE |
+			   MOD_ASSIGNED | MOD_USERTYPE | MOD_ACCESSED | MOD_EXPLICITLY_SIGNED),
+	MOD_PTRINHERIT	= (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE),
+};
 
 /* Current parsing/evaluation function */
 extern struct symbol *current_fn;
Signature · 1 line
1.6.3.1.169.g33fd.dirty
#2 lore raw

PATCH 3/3 Whitespace tweaks in symbol.h

Changes-licensed-under: ISC license

---
 symbol.h |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
symbol.h +11 -11
index 4a16f0d..3dd4531 100644
@@ -24,16 +24,16 @@
  * declared.
  */
 enum namespace {
-	NS_NONE = 0,
-	NS_MACRO = 1,
-	NS_TYPEDEF = 2,
-	NS_STRUCT = 4,  // Also used for unions and enums.
-	NS_LABEL = 8,
-	NS_SYMBOL = 16,
-	NS_ITERATOR = 32,
-	NS_PREPROCESSOR = 64,
-	NS_UNDEF = 128,
-	NS_KEYWORD = 256,
+	NS_NONE		= 0,
+	NS_MACRO	= 1,
+	NS_TYPEDEF	= 2,
+	NS_STRUCT	= 4,  // Also used for unions and enums.
+	NS_LABEL	= 8,
+	NS_SYMBOL	= 16,
+	NS_ITERATOR	= 32,
+	NS_PREPROCESSOR	= 64,
+	NS_UNDEF	= 128,
+	NS_KEYWORD	= 256,
 };
 
 enum type {
@@ -59,7 +59,7 @@ enum type {
 };
 
 enum keyword {
-	KW_SPECIFIER 	= 1 << 0,
+	KW_SPECIFIER	= 1 << 0,
 	KW_MODIFIER	= 1 << 1,
 	KW_QUALIFIER	= 1 << 2,
 	KW_ATTRIBUTE	= 1 << 3,
Signature · 1 line
1.6.3.1.169.g33fd.dirty
#3 lore raw

Re: [PATCH 2/3] Replace SYM_ and MOD_ #defines with enums in symbol.h.

In reply to Samuel Bronson
Quoted 1 line · Samuel Bronson

Adjust the associated fields to match.

Dang it, I seem to have somehow forgotten to test after this step ... whoops!

#5 lore raw
Quoted 4 lines · Alexey Zaytsev
Quoted 1 line · Samuel Bronson

Changes-licensed-under: ISC license

I don't think it works that way.

Yeah, yeah, well it's a simple permissive license, so even if the patch introduced anything copyrightable -- which it presumably doesn't -- you could use it anyway.

I just don't feel comfortable contributing under the OSL 1.1, for some reason -- possibly because it's considered non-DFSG, possibly because it's even more restrictive than the GPL ...

#6 lore raw
Quoted 3 lines · Samuel Bronson

I just don't feel comfortable contributing under the OSL 1.1, for some reason -- possibly because it's considered non-DFSG, possibly because it's even more restrictive than the GPL ...

If you look at the recent mailing list archives, you will find that a particular snapshot of the git tree was relicensed by the original copyright holder (Transmeta?) under the MIT license. It seems the current developers intend to check with the other copyright holders (for code commited after the particular relicensed snapshot) for a license change.

So I would you suggest at least using the MIT license to not "pollute" the code with yet another license...

The developers might need to confirm this, I'm just on "monitoring mode" here currently :)

Regards,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia (INdT)
Manaus - Brazil
#7 lore raw
Quoted 12 lines · Anderson Lizardo
Quoted 3 lines · Samuel Bronson

I just don't feel comfortable contributing under the OSL 1.1, for some reason -- possibly because it's considered non-DFSG, possibly because it's even more restrictive than the GPL ...

If you look at the recent mailing list archives, you will find that a particular snapshot of the git tree was relicensed by the original copyright holder (Transmeta?) under the MIT license. It seems the current developers intend to check with the other copyright holders (for code commited after the particular relicensed snapshot) for a license change.

Quoted 2 lines

So I would you suggest at least using the MIT license to not "pollute" the code with yet another license...

Oh, sure, that's fine with me! Hadn't heard about that. The MIT/X11 license is almost the same as the ISC license. Go ahead and s/ISC license/MIT license/ in these patches, though I don't think either of the patches that actually work (1/3 and 3/3) give me copyright on any code anyway.

#8 lore raw
Quoted 14 lines · Samuel Bronson
Quoted 12 lines · Anderson Lizardo
Quoted 3 lines · Samuel Bronson

I just don't feel comfortable contributing under the OSL 1.1, for some reason -- possibly because it's considered non-DFSG, possibly because it's even more restrictive than the GPL ...

If you look at the recent mailing list archives, you will find that a particular snapshot of the git tree was relicensed by the original copyright holder (Transmeta?) under the MIT license. It seems the current developers intend to check with the other copyright holders (for code commited after the particular relicensed snapshot) for a license change.

Quoted 9 lines
Quoted 2 lines

So I would you suggest at least using the MIT license to not "pollute" the code with yet another license...

Oh, sure, that's fine with me! Hadn't heard about that. The MIT/X11 license is almost the same as the ISC license. Go ahead and s/ISC license/MIT license/ in these patches, though I don't think either of the patches that actually work (1/3 and 3/3) give me copyright on any code anyway.

Won't work that easily. Only an early sparse version, owned exclusively by transmeta may be alternatively distribute under the MIT license. To convert the current sparse version to MIT, we need to get all the contributors to agree to this. Not impossible, but someone needs to send lots of emails. ;)

#9 lore raw
Quoted 5 lines · Alexey Zaytsev

Won't work that easily. Only an early sparse version, owned exclusively by transmeta may be alternatively distribute under the MIT license. To convert the current sparse version to MIT, we need to get all the contributors to agree to this. Not impossible, but someone needs to send lots of emails. ;)

Yes, well, count me in -- now all I have to do is actually contribute something copyrightable ;-)

#10 lore raw
In reply to Samuel Bronson
Quoted 6 lines · Samuel Bronson
Quoted 4 lines · Alexey Zaytsev
Quoted 1 line · Samuel Bronson

Changes-licensed-under: ISC license

I don't think it works that way.

Quoted 8 lines

Yeah, yeah, well it's a simple permissive license, so even if the patch introduced anything copyrightable -- which it presumably doesn't -- you could use it anyway.

I just don't feel comfortable contributing under the OSL 1.1, for some reason -- possibly because it's considered non-DFSG, possibly because it's even more restrictive than the GPL ...

I'm not your lawyer, and not the sparse maintainer, but I strongly suspect that that means that you can't contribute to sparse. And I'm not sure if you could distribute the patches you sent at all, since they are derivative work, and should be covered with the same license as sparse itself.

c) to distribute copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute shall be licensed under the Open Software License;